/* XCode Docs - Glassmorphism Dark Theme */
/* Modern CSS with Glass Effects and SEO-friendly structure */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --accent: #06b6d4;

    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;

    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-bg-hover: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: blur(20px);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;

    --gradient-primary: linear-gradient(135deg, #6366f1, #ec4899);
    --gradient-glow: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.2), transparent 50%);

    --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);

    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(99, 102, 241, 0.15), transparent 60%);
    pointer-events: none;
    z-index: -1;
    animation: pulse 15s infinite alternate;
}

@keyframes pulse {
    0% {
        transform: scale(1) translate(0, 0);
    }

    100% {
        transform: scale(1.1) translate(-2%, -2%);
    }
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    background: linear-gradient(to bottom right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

h1 {
    font-size: clamp(2.5rem, 8vw, 4.5rem);
}

h2 {
    font-size: clamp(2rem, 5vw, 2.75rem);
}

h3 {
    font-size: 1.75rem;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

a:hover {
    color: #fff;
    text-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}

p {
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    font-size: 1.1rem;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Full-width container for inner pages */
.container-fluid {
    width: 100%;
    padding-left: 2rem;
    padding-right: 2rem;
    max-width: 100%;
}

@media (max-width: 768px) {

    .container,
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Glass Effect Mixin */
.glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 10, 15, 0.95);
    /* Increased opacity */
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 0;
}

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

.search-box {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.6rem 1.25rem 0.6rem 2.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    color: #fff;
    transition: all 0.3s;
}

.search-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
    outline: none;
}

.nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.nav-link:hover {
    color: #fff;
    transform: translateY(-1px);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.01em;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 1.1rem;
}

/* Doc Layout */
.doc-layout {
    display: flex;
    gap: 3rem;
    padding-top: 100px;
    position: relative;
}

.sidebar {
    width: 300px;
    height: calc(100vh - 120px);
    position: sticky;
    top: 100px;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    overflow-y: auto;
}

.sidebar-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-list a {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.sidebar-list a:hover,
.sidebar-list a.active {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.sidebar-list a.active {
    color: var(--primary-light);
    border-left: 3px solid var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.article-container {
    flex: 1;
    min-width: 0;
}

.article-content {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.article-content h2 {
    margin: 3rem 0 1.5rem;
    color: #fff;
    -webkit-text-fill-color: initial;
    background: none;
}

.article-content h3 {
    margin: 2rem 0 1rem;
    color: #fff;
    -webkit-text-fill-color: initial;
    background: none;
}

.article-content pre {
    background: #0f172a;
    padding: 2rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    border: 1px solid var(--glass-border);
    margin: 2rem 0;
}

.article-content code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
}

/* Footer Fixes */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--glass-border);
    padding: 4rem 0 2rem;
    margin-top: auto;
    /* Push to bottom */
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    /* Better responsiveness */
    gap: 3rem;
    margin-bottom: 3rem;
}

/* Sidebar Responsive */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 65px;
        bottom: 0;
        height: auto;
        transition: left 0.3s ease;
    }

    .sidebar.active {
        left: 0;
    }

    .doc-content {
        padding: 2rem 1.5rem;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

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

/* Admin Styles */
.admin-layout {
    display: flex;
    min-height: 100vh;
    padding-top: 70px;
}

.admin-sidebar {
    width: 250px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--glass-border);
    padding: 1.5rem;
    position: fixed;
    top: 70px;
    left: 0;
    bottom: 0;
}

.admin-content {
    flex: 1;
    margin-left: 250px;
    padding: 2rem;
    min-width: 0;
    /* Critical for grid/table overflow */
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-textarea {
    min-height: 300px;
    resize: vertical;
    font-family: 'JetBrains Mono', monospace;
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* Tables */
.doc-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.doc-table th {
    text-align: left;
    padding: 1.25rem 1.5rem;
    border-bottom: 2px solid var(--glass-border);
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}

.doc-table td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-size: 0.95rem;
}

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

.doc-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.doc-card {
    overflow-x: auto;
}

.doc-table {
    min-width: 600px;
}

/* Sidebar Link Active State */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all 0.3s;
    font-weight: 500;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    transform: translateX(4px);
}

.sidebar-link.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-light);
    border-left: 3px solid var(--primary);
}

/* Badges */
.badge {
    display: inline-flex;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* Card overrides for admin */
.doc-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

/* OS Tabs */
.os-tabs {
    display: flex;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 0;
    border: 1px solid var(--glass-border);
}

.os-tab {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.os-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.os-tab.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.os-content {
    background: #0f172a;
    border: 1px solid var(--glass-border);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    padding: 2rem;
    margin-top: -1px;
    display: none;
}

/* Search Dropdown */
.search-dropdown {
    transition: opacity 0.2s ease;
}

.search-dropdown a:hover {
    background: rgba(255, 255, 255, 0.08) !important;
}