﻿/* Color Systems & Variables */
:root {
    --bg-card: #ffffff;
    --brand-color: #2563eb;
    --brand-hover: #1d4ed8;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #cbd5e1;
    --border-focus: #2563eb;
    --error-color: #ef4444;
    --success-color: #22c55e;
    --radius-main: 20px;
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Foundations */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    background:
        radial-gradient(circle at 12% 8%, rgba(62, 129, 143, 0.28), transparent 34rem),
        radial-gradient(circle at 90% 28%, rgba(110, 66, 140, 0.22), transparent 30rem),
        linear-gradient(135deg, #020617 0%, #0f172a 55%, #172554 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    min-height: 100vh;
    padding: 0 20px 32px;
}

.home-link {
    position: fixed;
    right: 20px;
    bottom: 20px;
    color: #bfdbfe;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.home-link:hover, .home-link:focus-visible {
    color: #ffffff;
    text-decoration: underline;
}

/* Auth Card layout */
.card-container {
    background: rgba(15, 23, 42, 0.82);
    width: 100%;
    max-width: 440px;
    border-radius: 24px;
    padding: 42px 34px 30px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.42);
    margin: auto;
    min-height: 620px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    animation: card-entry 0.5s ease-out both;
}

@keyframes card-entry {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.card-header {
    text-align: center;
    margin-bottom: 24px;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: rgba(114, 224, 209, 0.14);
    color: #72e0d1;
    border: 1px solid rgba(114, 224, 209, 0.25);
    border-radius: 50%;
    margin-bottom: 18px;
    box-shadow: 0 12px 24px rgba(114, 224, 209, 0.12);
}

.card-header h2 {
    color: #f8fbff;
    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(2rem, 4vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    margin-bottom: 6px;
}

.card-header p {
    color: #dfe7f3;
    font-size: 14px;
    line-height: 1.7;
}

/* Form & Layout Inputs */
.input-field {
    margin-bottom: 20px;
    position: relative;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

label {
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    width: 100%;
    padding: 13px 44px 13px 42px;
    font-size: 15px;
    border: 1px solid rgba(148, 163, 184, 0.38);
    border-radius: 10px;
    outline: none;
    background: rgba(255, 255, 255, 0.04);
    color: #f8fbff;
    transition: var(--transition-smooth);
}

.input-wrapper input::placeholder {
    color: #94a3b8;
}

.input-wrapper input:focus {
    border-color: rgba(114, 224, 209, 0.9);
    box-shadow: 0 0 0 4px rgba(114, 224, 209, 0.12);
}

.field-icon {
    position: absolute;
    left: 12px;
    color: #cbd5e1;
    font-size: 20px;
    pointer-events: none;
}

/* Password Reveal Switch Toggle */
.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 4px;
}

.toggle-password:hover {
    color: #f8fbff;
}

.toggle-password:focus-visible,
.context-link:focus-visible,
.sign-out-button:focus-visible,
.home-link:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.3);
    outline-offset: 3px;
    border-radius: 4px;
}

/* Interactive Utility Links */
.context-link {
    font-size: 13px;
    color: #72e0d1;
    text-decoration: none;
    font-weight: 500;
}

.context-link:hover {
    text-decoration: underline;
}

.context-link.highlight {
    font-weight: 600;
}

/* State Management: Active Field Validation States */
.input-field.error input {
    border-color: var(--error-color);
}
.input-field.error input:focus {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}
.input-field.error .field-icon {
    color: var(--error-color);
}
.error-text {
    font-size: 12px;
    color: var(--error-color);
    margin-top: 5px;
    display: none;
}
.input-field.error .error-text {
    display: block;
}

/* Advanced Custom Custom Checkbox UI */
.form-options {
    margin-bottom: 24px;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 28px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-muted);
    user-select: none;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    left: 0;
    height: 18px;
    width: 18px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: var(--transition-smooth);
}

.custom-checkbox:hover input ~ .checkmark {
    border-color: var(--brand-color);
}

.custom-checkbox input:checked ~ .checkmark {
    background-color: var(--brand-color);
    border-color: var(--brand-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.custom-checkbox input:checked ~ .checkmark:after {
    display: block;
}

/* Submit Action Control With Inline Spinner */
.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    transition: var(--transition-smooth);
    box-shadow: 0 16px 28px rgba(37, 99, 235, 0.28);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
}

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 16px;
    color: #cbd5e1;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.divider::before,
.divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: rgba(148, 163, 184, 0.38);
}

.google-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    color: #f8fbff;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.38);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
}

.google-button:hover {
    border-color: rgba(114, 224, 209, 0.75);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.22);
}

.google-button:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.25);
    outline-offset: 3px;
}

.google-mark {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    color: #4285f4;
    border: 1px solid #d9e2f3;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    display: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Loading state styles toggled by script */
.btn-primary.loading .btn-text {
    display: none;
}
.btn-primary.loading .btn-spinner {
    display: block;
}

.form-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: #dfe7f3;
}

.account-panel {
    text-align: center;
}

.account-icon {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    margin: 0 auto 20px;
    border-radius: 50%;
    color: #ffffff;
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.3);
}

.account-icon .material-symbols-rounded {
    font-size: 42px;
}

.eyebrow {
    color: #72e0d1;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.account-panel h2 {
    color: #f8fbff;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 25px;
    margin: 8px 0;
}

.account-email {
    overflow-wrap: anywhere;
    color: #dfe7f3;
    font-size: 14px;
    margin-bottom: 26px;
}

.account-button {
    gap: 8px;
    text-decoration: none;
}

.account-button .material-symbols-rounded {
    font-size: 20px;
}

.sign-out-button {
    margin-top: 18px;
    padding: 4px 8px;
    color: var(--text-muted);
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 13px;
}

.sign-out-button:hover {
    color: var(--text-main);
    text-decoration: underline;
}

@media (max-width: 520px) {
    .card-container {
        padding: 32px 24px;
    }

    .home-link {
        right: 16px;
        bottom: 14px;
    }
}

.admin-container {
    width: min(1100px, 100%);
    margin: auto;
    padding: 42px;
    color: var(--text-main);
    background: var(--bg-card);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-main);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
}

.admin-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.admin-header h1 {
    margin: 6px 0;
    font-size: 30px;
}

.admin-subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

.admin-refresh {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--brand-color);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.security-notice {
    display: flex;
    gap: 10px;
    padding: 14px 16px;
    margin-bottom: 20px;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.5;
}

.security-notice .material-symbols-rounded {
    flex: 0 0 auto;
}

.admin-stats {
    display: flex;
    gap: 14px;
    margin-bottom: 20px;
}

.admin-stats div {
    min-width: 150px;
    padding: 16px;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    background: #eff6ff;
}

.admin-stats span,
.admin-stats small {
    display: block;
}

.admin-stats span {
    color: var(--brand-color);
    font-size: 26px;
    font-weight: 700;
}

.admin-stats small {
    color: var(--text-muted);
    font-size: 12px;
}

.records-card {
    margin-top: 20px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
}

.records-card h2 {
    margin-bottom: 16px;
    font-size: 18px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}

th {
    color: var(--text-muted);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.empty-state {
    padding: 20px 0 4px;
    color: var(--text-muted);
    font-size: 14px;
}

@media (max-width: 680px) {
    .admin-container {
        padding: 28px 20px;
    }

    .admin-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

