/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4E85E6;
    --accent-color: #6366f1;
    --gradient: linear-gradient(135deg, #6366f1 0%, #4E85E6 100%);
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --background: #ffffff;
    --background-alt: #f9fafb;
    --border: #e5e7eb;
    --success: #d1fae5;
    --error: #fee2e2;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --card-bg: var(--background);
    --card-border: rgba(255, 255, 255, 0.15);
    --glass-highlight: rgba(255, 255, 255, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 480px;
    padding: 2rem;
}

.content {
    background: var(--background);
    border-radius: 1.5rem;
    padding: 3rem 2rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

/* Landing Page Look & Feel */
body.landing {
    --text-primary: #f8faff;
    --text-secondary: rgba(248, 250, 255, 0.75);
    --success: rgba(74, 222, 128, 0.2);
    --error: rgba(248, 113, 113, 0.2);
    --card-bg: rgba(15, 23, 42, 0.35);
    color: var(--text-primary);
    background: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.35), transparent 35%),
                radial-gradient(circle at 80% 0%, rgba(78, 133, 230, 0.4), transparent 45%),
                #050816;
    line-height: 1.7;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

body.landing::before,
body.landing::after {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    background: var(--gradient);
    filter: blur(90px);
    opacity: 0.35;
    z-index: 0;
    animation: pulse 12s ease-in-out infinite;
}

body.landing::before {
    top: -120px;
    right: -60px;
}

body.landing::after {
    bottom: -180px;
    left: -40px;
    animation-delay: -6s;
}

.landing .container {
    width: min(100%, 960px);
    max-width: 960px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.landing .content {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 2.5rem;
    padding: 3.5rem;
    box-shadow: 0 35px 80px rgba(5, 8, 22, 0.65);
    text-align: center;
    backdrop-filter: blur(24px);
    position: relative;
    overflow: hidden;
}

.landing .content::before,
.landing .content::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.05);
    pointer-events: none;
}

.landing .content::after {
    inset: 1.15rem;
    border-radius: 2rem;
    opacity: 0.35;
}

.landing .content > * {
    position: relative;
    z-index: 1;
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.logo svg {
    width: 160px;
    height: 160px;
    color: var(--primary);
}

.logo h1 {
    font-size: clamp(2.6rem, 6vw, 3.5rem);
    font-weight: 600;
    color: white;
    margin-bottom: 1.25rem;
    letter-spacing: -0.03em;
}

.landing .tagline {
    margin-bottom: 1.75rem;
}

.landing .tagline p {
    font-size: 1.2rem;
    color: var(--text-primary);
    font-weight: 500;
    letter-spacing: 0.04em;
}

.landing .description {
    margin-bottom: 2.75rem;
}

.landing .description p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 0.35rem;
}

/* Form Styles */
.landing .email-form {
    margin-bottom: 2rem;
}

.landing .form-group {
    display: flex;
    gap: 0.85rem;
    padding: 0.6rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
    align-items: center;
    width: 100%;
}

.landing #emailInput {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.85rem 1.4rem;
    font-size: 1rem;
    border: none;
    border-radius: 999px;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
    background: transparent;
    color: var(--text-primary);
}

.landing #emailInput:focus {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.landing #emailInput::placeholder {
    color: rgba(248, 250, 255, 0.5);
}

.landing button[type="submit"] {
    min-width: 170px;
    flex-shrink: 0;
    padding: 0.95rem 1.8rem;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: var(--gradient);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.35);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.landing button[type="submit"]::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.35), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.landing button[type="submit"]:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px rgba(78, 133, 230, 0.45);
}

.landing button[type="submit"]:hover::after {
    opacity: 1;
}

.landing button[type="submit"]:active {
    transform: translateY(-1px);
}

.landing button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Message Styles */
.message {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    display: none;
    border: 1px solid transparent;
}

.message.success {
    display: block;
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.message.error {
    display: block;
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

body.landing .message {
    border: 1px solid transparent;
    color: var(--text-primary);
}

body.landing .message.success {
    background-color: var(--success);
    color: var(--text-primary);
    border-color: rgba(74, 222, 128, 0.35);
}

body.landing .message.error {
    background-color: var(--error);
    color: var(--text-primary);
    border-color: rgba(248, 113, 113, 0.35);
}

/* Footer */
.landing .footer {
    margin-top: 2.5rem;
    padding-top: 1.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
}

.landing .footer p {
    font-size: 0.875rem;
    color: rgba(248, 250, 255, 0.55);
    margin-bottom: 0.75rem;
}

.landing .footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.landing .footer-link {
    font-size: 0.875rem;
    color: rgba(248, 250, 255, 0.55);
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 400;
}

.landing .footer-link:hover {
    color: rgba(248, 250, 255, 0.85);
    text-decoration: none;
}

.landing .footer-link:visited {
    color: rgba(248, 250, 255, 0.55);
}

.landing .footer-divider {
    font-size: 0.875rem;
    color: rgba(248, 250, 255, 0.35);
}

.landing .admin-link {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    color: rgba(255, 255, 255, 0.2);
    text-decoration: none;
    font-size: 0.5rem;
    opacity: 0.4;
    transition: opacity 0.2s ease;
}

.landing .admin-link:hover {
    opacity: 0.8;
}

@media (max-width: 640px) {
    body.landing {
        padding: 1.5rem;
    }

    .landing .container {
        padding: 0;
        max-width: 100%;
    }

    .landing .content {
        padding: 2.5rem 1.75rem;
        border-radius: 1.75rem;
    }

    .landing .logo h1 {
        font-size: clamp(2.4rem, 12vw, 3rem);
    }

    .landing .tagline p {
        font-size: 1.05rem;
    }

    .landing .form-group {
        flex-direction: column;
        border-radius: 1.5rem;
    }

    .landing button[type="submit"] {
        width: 100%;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.35;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.55;
    }
}

/* Admin Page Styles */
.admin-container {
    max-width: 800px;
    padding: 2rem;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.admin-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.admin-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.35rem;
}

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.admin-email {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.ghost-btn {
    padding: 0.55rem 1rem;
    border-radius: 0.65rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--primary-color);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.ghost-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    background: rgba(78, 133, 230, 0.08);
}

.ghost-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.logout-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: var(--background-alt);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.logout-btn:hover {
    background: var(--background);
    border-color: var(--text-secondary);
}

.auth-container {
    text-align: center;
    padding: 3rem 2rem;
}

.auth-container h2 {
    margin-bottom: 2rem;
    font-size: 1.75rem;
}

.google-signin-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    background: white;
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    font-family: inherit;
}

.google-signin-btn:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.table-container {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    overflow-x: auto;
}

.stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.stat-card {
    flex: 1;
    min-width: 150px;
    padding: 1rem;
    background: var(--background-alt);
    border-radius: 0.75rem;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

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

thead {
    background: var(--background-alt);
}

th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9375rem;
}

tbody tr:hover {
    background: var(--background-alt);
}

tbody tr:last-child td {
    border-bottom: none;
}

.actions-col {
    text-align: right;
    width: 120px;
}

.delete-btn {
    padding: 0.4rem 0.8rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.08);
    color: #b91c1c;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.delete-btn:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.15);
}

.delete-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.empty-state p {
    margin-bottom: 0.5rem;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 640px) {
    body:not(.landing) .container {
        padding: 1rem;
    }

    body:not(.landing) .content {
        padding: 2rem 1.5rem;
    }

    body:not(.landing) .logo h1 {
        font-size: 2rem;
    }

    body:not(.landing) .tagline p {
        font-size: 1rem;
    }

    .admin-container {
        padding: 1rem;
    }

    .admin-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .admin-header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .table-container {
        padding: 1rem;
    }

    th, td {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
}
