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

html {
    scroll-behavior: smooth;
}

::selection {
    background: rgba(24, 24, 27, 0.15);
    color: var(--text-color);
}

:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

:root {
    --primary-color: #18181b;
    --primary-hover: #27272a;
    --primary-light: rgba(24, 24, 27, 0.06);
    --primary-ring: rgba(24, 24, 27, 0.15);
    --accent-color: #52525b;
    --success-color: #18181b;
    --error-color: #dc2626;
    --warning-color: #a16207;
    --bg-color: #fafafa;
    --card-bg: #ffffff;
    --text-color: #09090b;
    --text-muted: #71717a;
    --text-light: #a1a1aa;
    --border-color: #e4e4e7;
    --border-light: #f4f4f5;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --header-height: 64px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--text-color);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent-color);
}

/* Header */
.site-header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-color);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.site-logo:hover {
    text-decoration: none;
}

.site-logo svg {
    width: 28px;
    height: 28px;
    color: var(--text-color);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-nav a {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition);
}

.header-nav a:hover {
    color: var(--text-color);
    background: var(--border-light);
    text-decoration: none;
}

.header-nav a.active {
    color: var(--text-color);
    background: var(--primary-light);
    font-weight: 600;
}

/* Auth nav buttons */
.nav-btn {
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition);
    border: none;
    cursor: pointer;
}

.nav-btn:hover {
    text-decoration: none;
}

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

.header-nav .nav-btn-outline:hover,
.nav-btn-outline:hover {
    background: var(--primary-color);
    color: #fff;
    border: 1px solid transparent;
}

.header-nav .nav-btn-primary,
.nav-btn-primary {
    color: #fff;
    background: var(--primary-color);
}

.nav-btn-primary:hover {
    background: var(--primary-hover);
}

/* Mobile menu */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text-color);
}

/* Main Content */
.main-content {
    flex: 1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.container-sm {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 24px;
}

.container-md {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Footer */
.site-footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 32px 24px;
    margin-top: auto;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.footer-links {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-decoration: none;
    transition: color var(--transition);
}

.footer-links a:hover {
    color: var(--text-color);
    text-decoration: none;
}

.footer-copy {
    color: var(--text-light);
    font-size: 0.8125rem;
    text-align: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    text-decoration: none;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.btn:hover {
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

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

.btn-success {
    background: var(--primary-color);
    color: #fff;
}

.btn-success:hover {
    background: var(--primary-hover);
}

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

.btn-danger:hover {
    filter: brightness(0.9);
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.btn-block {
    width: 100%;
}

.btn:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Card */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
}

/* Form */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-color);
    letter-spacing: -0.01em;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    color: var(--text-color);
    background: var(--card-bg);
    transition: all var(--transition);
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

.form-input::placeholder {
    color: var(--text-light);
}

.form-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-error {
    font-size: 0.8125rem;
    color: var(--error-color);
    margin-top: 4px;
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--text-light);
    font-size: 0.8125rem;
}

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

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary-color);
}

.badge-success {
    background: var(--primary-light);
    color: var(--primary-color);
}

.badge-warning {
    background: rgba(161, 98, 7, 0.08);
    color: var(--warning-color);
}

.badge-error {
    background: rgba(220, 38, 38, 0.08);
    color: var(--error-color);
}

/* Table */
.table-wrapper {
    overflow-x: auto;
}

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

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

th {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

td {
    font-size: 0.875rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(9, 9, 11, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.hidden {
    display: none;
}

.modal-box {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 440px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.modal-box h3 {
    font-size: 1.25rem;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.modal-box p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 24px;
    border-radius: var(--radius);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 420px;
}

.toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: color var(--transition);
}

.toast-close:hover {
    color: #fff;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-success {
    background: var(--primary-color);
}

.toast-error {
    background: var(--error-color);
}

/* Utilities */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* Responsive */
@media (max-width: 768px) {
    .site-header {
        padding: 0 16px;
    }

    .header-nav {
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        padding: 0 16px;
        box-shadow: var(--shadow-md);
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
    }

    .header-nav.open {
        display: flex;
        max-height: 400px;
        opacity: 1;
        padding: 16px;
    }

    .header-nav a,
    .header-nav .nav-btn {
        width: 100%;
        text-align: center;
    }

    .menu-toggle {
        display: flex;
    }

    .container {
        padding: 0 16px;
    }

    .footer-links {
        gap: 16px;
    }
}
