/* ===========================================
   Base Styles & Modern Reset
   SyncVault Modern Dark Theme
   =========================================== */

/* ===== CSS RESET ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    background-image:
        radial-gradient(ellipse 100% 80% at 50% 0%, rgba(255, 0, 85, 0.28), transparent 60%),
        radial-gradient(ellipse 100% 60% at 50% 100%, rgba(139, 92, 246, 0.18), transparent 60%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p {
    margin-bottom: 1rem;
}

strong, b {
    font-weight: 600;
}

small {
    font-size: var(--text-sm);
}

/* ===== LINKS ===== */
a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

/* ===== MEDIA ===== */
img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===== LISTS ===== */
ul, ol {
    list-style: none;
}

/* ===== NAVBAR ===== */
.navbar {
    background: var(--bg-body);
    border-bottom: 1px solid var(--border);
    padding: 0 var(--space-6);
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    backdrop-filter: blur(12px);
    background: rgba(9, 9, 11, 0.85);
}

.brand {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
}

.brand:hover {
    color: var(--text-primary);
}

.brand i {
    color: var(--primary);
    font-size: 1.4rem;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link {
    display: block;
    padding: var(--space-2) var(--space-4);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

.nav-link.active {
    color: var(--primary);
    background-color: var(--primary-soft);
}

.navbar-status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-6);
}

/* ===== CONTAINER ===== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

.container-sm,
.container-md,
.container-lg {
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

.container-sm { max-width: 640px; }
.container-md { max-width: 900px; }
.container-lg { max-width: 1200px; }

/* ===== GRID UTILITIES ===== */
.grid {
    display: grid;
    gap: var(--space-6);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-6);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
}

.grid-header {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-6);
}

/* ===== FLEX UTILITIES ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* ===== SPACING UTILITIES ===== */
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

/* ===== TEXT UTILITIES ===== */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

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

.text-primary-color { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.uppercase { text-transform: uppercase; }
.capitalize { text-transform: capitalize; }
.tracking-wide { letter-spacing: 0.05em; }

/* ===== GRADIENT TEXT ===== */
.gradient-text {
    background: linear-gradient(135deg, var(--primary), #FF6699);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-surface);
}

::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-hover) var(--bg-surface);
}

/* ===== SELECTION ===== */
::selection {
    background: var(--primary);
    color: white;
}

/* ===== FOCUS STYLES ===== */
:focus {
    outline: none;
}

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

/* ===== SCROLL AREA ===== */
.scroll-area {
    overflow-y: auto;
}

.scroll-area-x {
    overflow-x: auto;
}

/* ===== DIVIDERS ===== */
.divider {
    height: 1px;
    background: var(--border);
    margin: var(--space-4) 0;
}

/* ===== HAMBURGER MENU ===== */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-2);
    min-width: 44px;
    min-height: 44px;
    z-index: 10;
}

.nav-toggle-bar {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-base);
    transform-origin: center;
}

.nav-toggle.active .nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.active .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active .nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Desktop: status pushed right, nav centered via absolute */
.nav-collapse {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
}

.navbar-nav {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .grid-2,
    .grid-3,
    .grid-4,
    .grid-header {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding: var(--space-4);
    }

    .navbar {
        padding: 0 var(--space-4);
    }

    .hide-mobile {
        display: none;
    }
}

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-collapse {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: rgba(9, 9, 11, 0.97);
        backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--border);
        padding: var(--space-4);
        gap: var(--space-3);
        z-index: var(--z-sticky);
    }

    .nav-collapse.open {
        display: flex;
    }

    .navbar {
        position: sticky;
    }

    .navbar-nav {
        position: static;
        transform: none;
        flex-direction: column;
        width: 100%;
        gap: var(--space-1);
    }

    .nav-link {
        display: flex;
        align-items: center;
        padding: var(--space-3) var(--space-4);
        min-height: 44px;
        border-radius: var(--radius-md);
    }

    .navbar-status {
        width: 100%;
        padding-top: var(--space-3);
        border-top: 1px solid var(--border);
        justify-content: center;
    }
}

@media (max-width: 640px) {
    html {
        font-size: 14px;
    }

    .container {
        padding: 0 var(--space-3);
    }

    .main-content {
        padding: var(--space-3);
    }

    h1 { font-size: var(--text-2xl); }
    h2 { font-size: var(--text-xl); }
}

/* ===== TOUCH TARGET ENFORCEMENT ===== */
@media (pointer: coarse) {
    .btn,
    .nav-link,
    .tab,
    .social-btn,
    .policy-checkbox,
    .btn-ghost,
    .btn-sm,
    .btn-icon,
    .search-mode-btn {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

.animate-fade-in {
    animation: fadeIn var(--transition-base);
}

.animate-slide-up {
    animation: slideUp var(--transition-slow);
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}
