/**
 * CTG Batch Certificate Finder - Frontend Styles
 * Modern, clean pharma-grade UI
 */

/* ========================================
   CSS VARIABLES (defaults, overridden via PHP)
   ======================================== */
:root {
    --ctg-primary: #0d7377;
    --ctg-secondary: #14919b;
    --ctg-primary-light: #0d737715;
    --ctg-gradient: linear-gradient(135deg, #0d7377, #14919b);
    --ctg-text: #1a1a2e;
    --ctg-text-light: #64748b;
    --ctg-bg: #f8fafc;
    --ctg-white: #ffffff;
    --ctg-border: #e2e8f0;
    --ctg-shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --ctg-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --ctg-shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.08), 0 4px 10px -4px rgba(0,0,0,0.04);
    --ctg-shadow-xl: 0 20px 50px -12px rgba(0,0,0,0.12);
    --ctg-radius: 12px;
    --ctg-radius-lg: 20px;
    --ctg-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   RESET & BASE
   ======================================== */
.ctg-batch-finder-wrap {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--ctg-text);
    line-height: 1.6;
    max-width: 100%;
    margin: 0 auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.ctg-batch-finder-wrap *,
.ctg-batch-finder-wrap *::before,
.ctg-batch-finder-wrap *::after {
    box-sizing: border-box;
}

/* ========================================
   HERO SECTION
   ======================================== */
.ctg-hero-section {
    position: relative;
    background: var(--ctg-gradient);
    padding: 60px 24px 80px;
    text-align: center;
    overflow: hidden;
}

.ctg-hero-bg-pattern {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(255,255,255,0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.05) 0%, transparent 50%),
        radial-gradient(circle at 50% 80%, rgba(255,255,255,0.03) 0%, transparent 50%);
    pointer-events: none;
}

.ctg-hero-bg-pattern::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
}

.ctg-hero-bg-pattern::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(255,255,255,0.03);
}

.ctg-hero-content {
    position: relative;
    z-index: 1;
    max-width: 680px;
    margin: 0 auto;
}

.ctg-company-logo {
    max-height: 70px;
    width: auto;
    margin-bottom: 20px;
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

.ctg-hero-title {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 8px;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.ctg-hero-subtitle {
    font-size: 1.1rem;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
    margin: 0 0 24px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.ctg-hero-divider {
    width: 60px;
    height: 3px;
    background: rgba(255,255,255,0.4);
    margin: 0 auto 24px;
    border-radius: 2px;
}

.ctg-hero-description {
    font-size: 1.05rem;
    line-height: 1.7;
    color: rgba(255,255,255,0.8);
    margin: 0;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

/* ========================================
   SEARCH SECTION
   ======================================== */
.ctg-search-section {
    padding: 0 24px;
    margin-top: -40px;
    position: relative;
    z-index: 2;
}

.ctg-search-card {
    max-width: 640px;
    margin: 0 auto;
    background: var(--ctg-white);
    border-radius: var(--ctg-radius-lg);
    padding: 40px 36px 32px;
    box-shadow: var(--ctg-shadow-xl);
    text-align: center;
    border: 1px solid rgba(0,0,0,0.04);
}

.ctg-search-icon-wrap {
    width: 56px;
    height: 56px;
    background: var(--ctg-primary-light);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.ctg-search-shield-icon {
    width: 28px;
    height: 28px;
    color: var(--ctg-primary);
}

.ctg-search-title {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ctg-text);
    margin: 0 0 8px;
}

.ctg-search-instruction {
    font-size: 0.95rem;
    color: var(--ctg-text-light);
    margin: 0 0 28px;
    line-height: 1.6;
}

/* Input Group */
.ctg-search-form {
    margin: 0;
    padding: 0;
}

.ctg-input-group {
    display: flex;
    align-items: stretch;
    background: var(--ctg-bg);
    border: 2px solid var(--ctg-border);
    border-radius: var(--ctg-radius);
    overflow: hidden;
    transition: var(--ctg-transition);
}

.ctg-input-group:focus-within {
    border-color: var(--ctg-primary);
    box-shadow: 0 0 0 4px var(--ctg-primary-light);
    background: var(--ctg-white);
}

.ctg-input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px 0 16px;
    color: var(--ctg-text-light);
    flex-shrink: 0;
}

.ctg-input-icon svg {
    width: 22px;
    height: 22px;
    opacity: 0.5;
}

.ctg-batch-input {
    flex: 1;
    border: none !important;
    background: transparent !important;
    padding: 16px 12px !important;
    font-size: 1rem !important;
    font-family: 'Inter', sans-serif !important;
    color: var(--ctg-text) !important;
    outline: none !important;
    box-shadow: none !important;
    min-width: 0;
    margin: 0 !important;
    height: auto !important;
    line-height: 1.5 !important;
}

.ctg-batch-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.ctg-search-btn {
    flex-shrink: 0;
    background: var(--ctg-gradient) !important;
    color: #ffffff !important;
    border: none !important;
    padding: 16px 28px !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    font-family: 'Inter', sans-serif !important;
    cursor: pointer !important;
    transition: var(--ctg-transition) !important;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.02em;
    border-radius: 0 !important;
    line-height: 1.5 !important;
    margin: 0 !important;
    text-transform: none !important;
    box-shadow: none !important;
}

.ctg-search-btn:hover {
    opacity: 0.92 !important;
    transform: none;
}

.ctg-search-btn:active {
    opacity: 0.85 !important;
}

.ctg-search-btn:disabled {
    opacity: 0.7 !important;
    cursor: not-allowed !important;
}

/* Spinner */
.ctg-spinner {
    width: 20px;
    height: 20px;
    animation: ctg-spin 0.8s linear infinite;
}

@keyframes ctg-spin {
    100% { transform: rotate(360deg); }
}

/* Search Hint */
.ctg-search-hint {
    font-size: 0.82rem;
    color: #94a3b8;
    margin: 16px 0 0;
}

/* ========================================
   RESULTS SECTION
   ======================================== */
.ctg-results-section {
    padding: 0 24px;
    margin-top: 32px;
    margin-bottom: 20px;
}

.ctg-results-content {
    max-width: 640px;
    margin: 0 auto;
}

/* Result Card */
.ctg-result-card {
    background: var(--ctg-white);
    border-radius: var(--ctg-radius-lg);
    overflow: hidden;
    box-shadow: var(--ctg-shadow-lg);
    border: 1px solid rgba(0,0,0,0.04);
    margin-bottom: 20px;
    animation: ctg-slideUp 0.4s ease-out;
}

@keyframes ctg-slideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ctg-result-header {
    background: var(--ctg-gradient);
    padding: 20px 28px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.ctg-result-check-icon {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ctg-result-check-icon svg {
    width: 22px;
    height: 22px;
    color: #ffffff;
}

.ctg-result-header-text h3 {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 2px;
}

.ctg-result-header-text p {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.8);
    margin: 0;
}

/* Result Body */
.ctg-result-body {
    padding: 24px 28px;
}

.ctg-result-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.ctg-meta-item {
    padding: 14px 16px;
    background: var(--ctg-bg);
    border-radius: 10px;
    border: 1px solid var(--ctg-border);
}

.ctg-meta-item.full-width {
    grid-column: 1 / -1;
}

.ctg-meta-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ctg-text-light);
    margin: 0 0 4px;
}

.ctg-meta-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ctg-text);
    margin: 0;
    word-break: break-all;
}

/* PDF Actions */
.ctg-pdf-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.ctg-btn-download {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: var(--ctg-gradient);
    color: #ffffff;
    border: none;
    border-radius: var(--ctg-radius);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--ctg-transition);
    text-decoration: none;
    flex: 1;
    justify-content: center;
    min-width: 180px;
}

.ctg-btn-download:hover {
    opacity: 0.92;
    transform: translateY(-1px);
    box-shadow: var(--ctg-shadow-md);
    color: #ffffff;
    text-decoration: none;
}

.ctg-btn-download svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.ctg-btn-view {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: var(--ctg-white);
    color: var(--ctg-primary);
    border: 2px solid var(--ctg-primary);
    border-radius: var(--ctg-radius);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--ctg-transition);
    text-decoration: none;
    flex: 1;
    justify-content: center;
    min-width: 180px;
}

.ctg-btn-view:hover {
    background: var(--ctg-primary-light);
    transform: translateY(-1px);
    color: var(--ctg-primary);
    text-decoration: none;
}

.ctg-btn-view svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Error State */
.ctg-error-card {
    background: var(--ctg-white);
    border-radius: var(--ctg-radius-lg);
    padding: 40px 28px;
    text-align: center;
    box-shadow: var(--ctg-shadow-lg);
    border: 1px solid rgba(0,0,0,0.04);
    animation: ctg-slideUp 0.4s ease-out;
}

.ctg-error-icon {
    width: 56px;
    height: 56px;
    background: #fef2f2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.ctg-error-icon svg {
    width: 28px;
    height: 28px;
    color: #ef4444;
}

.ctg-error-card h3 {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ctg-text);
    margin: 0 0 8px;
}

.ctg-error-card p {
    font-size: 0.95rem;
    color: var(--ctg-text-light);
    margin: 0;
    line-height: 1.6;
}

/* ========================================
   TRUST BADGES
   ======================================== */
.ctg-trust-section {
    padding: 40px 24px 20px;
}

.ctg-trust-badges {
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
}

.ctg-trust-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ctg-text-light);
    font-size: 0.88rem;
    font-weight: 500;
}

.ctg-trust-item svg {
    color: var(--ctg-primary);
    opacity: 0.7;
    flex-shrink: 0;
}

/* ========================================
   FOOTER
   ======================================== */
.ctg-footer {
    text-align: center;
    padding: 20px 24px 40px;
}

.ctg-footer p {
    font-size: 0.82rem;
    color: #94a3b8;
    margin: 0;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 640px) {
    .ctg-hero-section {
        padding: 40px 20px 70px;
    }

    .ctg-hero-title {
        font-size: 1.8rem;
    }

    .ctg-hero-subtitle {
        font-size: 0.95rem;
    }

    .ctg-hero-description {
        font-size: 0.95rem;
    }

    .ctg-search-card {
        padding: 28px 20px 24px;
    }

    .ctg-input-group {
        flex-direction: column;
        border-radius: var(--ctg-radius);
    }

    .ctg-input-icon {
        display: none;
    }

    .ctg-batch-input {
        padding: 14px 16px !important;
        text-align: center;
        border-bottom: 1px solid var(--ctg-border) !important;
    }

    .ctg-search-btn {
        justify-content: center;
        padding: 14px 24px !important;
        border-radius: 0 0 10px 10px !important;
    }

    .ctg-result-header {
        padding: 16px 20px;
    }

    .ctg-result-body {
        padding: 20px;
    }

    .ctg-result-meta {
        grid-template-columns: 1fr;
    }

    .ctg-pdf-actions {
        flex-direction: column;
    }

    .ctg-trust-badges {
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }

    .ctg-btn-download,
    .ctg-btn-view {
        width: 100%;
    }
}

/* ========================================
   PDF EMBED VIEWER (for inline viewing)
   ======================================== */
.ctg-pdf-embed-wrap {
    margin-top: 16px;
    border-radius: var(--ctg-radius);
    overflow: hidden;
    border: 1px solid var(--ctg-border);
    background: #f1f5f9;
}

.ctg-pdf-embed-wrap iframe {
    width: 100%;
    height: 500px;
    border: none;
    display: block;
}

@media (max-width: 640px) {
    .ctg-pdf-embed-wrap iframe {
        height: 350px;
    }
}

/* ========================================
   ANIMATION UTILITIES
   ======================================== */
.ctg-fade-in {
    animation: ctg-fadeIn 0.3s ease-out;
}

@keyframes ctg-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========================================
   WORDPRESS THEME OVERRIDES
   (Ensures consistent look regardless of theme)
   ======================================== */
.ctg-batch-finder-wrap h1,
.ctg-batch-finder-wrap h2,
.ctg-batch-finder-wrap h3 {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    line-height: 1.3;
}

.ctg-batch-finder-wrap p {
    font-family: 'Inter', sans-serif;
}

.ctg-batch-finder-wrap input[type="text"] {
    -webkit-appearance: none;
    appearance: none;
}

.ctg-batch-finder-wrap a {
    text-decoration: none;
}

.ctg-batch-finder-wrap a:hover {
    text-decoration: none;
}
