/* ==========================================================
   Certificate Verification Portal — Stylesheet
   Theme: warm amber accent, clean glass-white cards
   ========================================================== */

:root {
    --color-primary: #F59E0B;
    --color-primary-dark: #C2760A;
    --color-primary-light: #FEF3C7;
    --color-success: #1E8E5A;
    --color-success-bg: #E9F8EF;
    --color-error: #C0392B;
    --color-error-bg: #FDECEA;
    --color-warning: #9A6B00;
    --color-warning-bg: #FFF6DE;
    --color-text: #1F2937;
    --color-text-muted: #6B7280;
    --color-border: #E5E7EB;
    --color-bg: #FAFAF9;
    --color-card-bg: rgba(255, 255, 255, 0.78);

    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;

    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;

    --shadow-soft: 0 20px 45px -20px rgba(43, 43, 43, 0.25);
    --shadow-card: 0 10px 25px -12px rgba(43, 43, 43, 0.18);
}

* {
    box-sizing: border-box;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-bg);
    background-image:
        radial-gradient(circle at 10% -10%, rgba(245, 158, 11, 0.18), transparent 40%),
        radial-gradient(circle at 90% 0%, rgba(245, 158, 11, 0.12), transparent 35%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    margin: 0;
}

/* ---------------- Header / Nav ---------------- */

.site-header {
    width: 100%;
    border-bottom: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.site-header__inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: var(--color-text);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.15;
}

.brand__mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 auto;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(31, 41, 55, 0.06);
}

.brand__mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.brand__text {
    display: flex;
    flex-direction: column;
}

.brand__text-full {
    font-size: 1rem;
}

.brand__text-sub {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    letter-spacing: 0.03em;
}

.top-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.top-nav a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.92rem;
    transition: color 0.15s ease;
}

.top-nav a:hover,
.top-nav a:focus-visible {
    color: var(--color-primary-dark);
}

.admin-nav-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.88rem;
    color: #4b5563 !important;
    text-decoration: none;
    transition: all 0.2s ease;
}

.admin-nav-item:hover {
    color: #111827 !important;
    background: #f3f4f6;
}

.admin-nav-item.active {
    background: #fef3c7 !important;
    color: #b45309 !important;
    font-weight: 700;
}

/* ---------------- Layout ---------------- */

.site-main {
    flex: 1;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}

.site-main--wide {
    max-width: 1080px;
}

.site-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

/* ---------------- Portal / Glass Card ---------------- */

.portal-card {
    background: var(--color-card-bg);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 2.5rem;
}

.portal-card__title {
    font-size: 1.6rem;
    font-weight: 700;
}

.portal-card__subtitle {
    margin-top: 0.5rem;
    color: var(--color-text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* ---------------- Forms ---------------- */

.search-form,
.admin-form {
    margin-top: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
}

.field--row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

input[type="text"],
input[type="tel"],
input[type="password"],
input[type="date"],
input[type="file"],
select,
textarea {
    width: 100%;
    font-family: var(--font-body);
    font-size: 0.98rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background-color: #fff;
    color: var(--color-text);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 16px 16px;
    padding-right: 2.5rem;
    cursor: pointer;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}

.phone-row {
    display: flex;
    gap: 0.6rem;
    width: 100%;
    box-sizing: border-box;
}

.phone-row select {
    flex: 0 0 40%;
    min-width: 150px;
}

.phone-row input {
    flex: 1;
    min-width: 0;
}

/* Divider */

.divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--color-text-muted);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

/* ---------------- Buttons ---------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.75rem 1.3rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn--block {
    width: 100%;
}

.btn--primary {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 8px 20px -8px rgba(245, 158, 11, 0.6);
}

.btn--primary:hover,
.btn--primary:focus-visible {
    background: var(--color-primary-dark);
}

.btn--secondary {
    background: #fff;
    color: var(--color-primary-dark);
    border: 1px solid var(--color-primary);
}

.btn--secondary:hover,
.btn--secondary:focus-visible {
    background: var(--color-primary-light);
}

.btn--danger {
    background: var(--color-error);
    color: #fff;
}

.btn--danger:hover {
    background: #a53225;
}

.btn--ghost {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.btn--small {
    padding: 0.5rem 0.85rem;
    font-size: 0.85rem;
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ---------------- Banners ---------------- */

.banner {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
}

.banner--success {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid rgba(30, 142, 90, 0.25);
}

.banner--error {
    background: var(--color-error-bg);
    color: var(--color-error);
    border: 1px solid rgba(192, 57, 43, 0.25);
}

.banner--warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border: 1px solid rgba(154, 107, 0, 0.25);
}

/* ---------------- Results / Certificate Cards ---------------- */

.results-section {
    margin-top: 2rem;
}

.cert-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cert-card {
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.cert-card__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed var(--color-border);
}

.cert-card__row:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.cert-card__label {
    color: var(--color-text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex: 0 0 auto;
}

.cert-card__value {
    text-align: right;
    font-weight: 600;
    font-size: 0.95rem;
    word-break: break-word;
}

.cert-card__actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.cert-card__actions .btn {
    flex: 1;
}

/* ---------------- Admin: general ---------------- */

.admin-body .site-main {
    max-width: 1080px;
}

.auth-card {
    max-width: 420px;
    margin: 2rem auto;
    background: var(--color-card-bg);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 2.5rem;
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 1.5rem;
}

.stat-card__number {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--color-primary-dark);
}

.stat-card__label {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-heading h1 {
    font-size: 1.5rem;
}

.panel {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 2rem;
}

/* ---------------- Admin: responsive table -> cards ---------------- */

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 0.85rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.9rem;
    vertical-align: middle;
}

.data-table th {
    color: var(--color-text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.data-table td.actions-cell {
    white-space: nowrap;
}

/* ---------------- Misc ---------------- */

.helper-text {
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

.current-file-note {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    background: var(--color-primary-light);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.85rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--color-text-muted);
}

/* ==========================================================
   Responsive: below 768px
   ========================================================== */

@media (max-width: 768px) {
    .site-main {
        padding: 1.5rem 1rem 3rem;
    }

    .portal-card,
    .auth-card {
        padding: 1.5rem;
    }

    .panel {
        padding: 1.25rem;
    }

    .phone-row {
        flex-direction: column;
    }

    .phone-row select {
        flex: 1 1 auto;
    }

    .field--row {
        grid-template-columns: 1fr;
    }

    .top-nav {
        gap: 0.85rem;
        font-size: 0.85rem;
    }

    .site-header__inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .brand__mark {
        width: 34px;
        height: 34px;
    }

    .brand__text-full {
        font-size: 0.9rem;
    }

    .brand__text-sub {
        font-size: 0.68rem;
    }

    /* Convert data table into vertical flex-cards on mobile */
    .data-table,
    .data-table thead,
    .data-table tbody,
    .data-table th,
    .data-table td,
    .data-table tr {
        display: block;
        width: 100%;
    }

    .data-table thead {
        display: none;
    }

    .data-table tr {
        background: #fff;
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-card);
        margin-bottom: 1rem;
        padding: 1rem 1.25rem;
    }

    .data-table td {
        border-bottom: 1px dashed var(--color-border);
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        padding: 0.6rem 0;
    }

    .data-table td:last-child {
        border-bottom: none;
    }

    .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--color-text-muted);
        font-size: 0.78rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        flex: 0 0 auto;
    }

    .data-table td.actions-cell {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .data-table td.actions-cell::before {
        width: 100%;
        margin-bottom: 0.35rem;
    }
}
/* ==========================================================================
   Responsive Form Enhancements
   ========================================================================== */
@media (max-width: 640px) {
    .phone-row {
        flex-direction: column;
        gap: 0.5rem;
    }

    .phone-row select {
        flex: 1 1 auto;
        width: 100%;
    }

    input[type="text"],
    input[type="tel"],
    input[type="date"],
    input[type="file"],
    select {
        font-size: 16px !important; /* Prevents auto-zoom on iOS Safari */
    }
}

