/* 288 Sparks Documentation Styles - Modern Design */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Crimson+Text:ital,wght@0,400;0,600;1,400&display=swap');

:root {
    /* Use CSS variables from theme-base.css */
    /* Refined Sefirot Colors - More sophisticated palette */
    --keter: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    --keter-accent: #495057;
    --chokmah: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --chokmah-accent: #667eea;
    --binah: linear-gradient(135deg, #134e5e 0%, #71b280 100%);
    --binah-accent: #2d8659;
    --chesed: linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%);
    --chesed-accent: #4a9eff;
    --gevurah: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    --gevurah-accent: #f85a8f;
    --tiferet: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    --tiferet-accent: #fb9f7f;
    --netzach: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    --netzach-accent: #7fd9d3;
    --hod: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    --hod-accent: #ff7a7e;
    --yesod: linear-gradient(135deg, #c471f5 0%, #fa71cd 100%);
    --yesod-accent: #b965e6;
    --malkhut: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
    --malkhut-accent: #7fb0f9;

    /* World Colors - Elegant gradients */
    --atziluth-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --atziluth-accent: #f36c7c;
    --beriah-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --beriah-accent: #2fa2fe;
    --yetzirah-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --yetzirah-accent: #3df1a7;
    --assiah-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    --assiah-accent: #fbb06f;

    /* Modern UI Colors - mapped to theme variables */
    --bg-primary: var(--color-bg-primary, #0a0e27);
    --bg-secondary: var(--color-bg-secondary, #151a35);
    --bg-card: var(--color-bg-card, #1a1f3a);
    --bg-card-hover: #222847;
    --text-primary: var(--color-text-primary, #f8f9fa);
    --text-secondary: var(--color-text-secondary, #adb5bd);
    --text-muted: var(--color-text-muted, #6c757d);
    --accent-primary: var(--color-primary, #8b7fff);
    --accent-secondary: var(--color-secondary, #ff7eb6);
    --accent-gold: var(--color-accent, #ffd93d);
    --border-primary: var(--color-border-primary, #2a2f4a);
    --border-accent: var(--color-border-accent, #4a4f6a);
    --success: #51cf66;
    --info: #4dabf7;
    --warning: #ffd43b;
    --glass-bg: rgba(var(--color-bg-card-rgb, 26, 31, 58), 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--color-bg-primary, #0a0e27);
    background-image:
        radial-gradient(at 40% 20%, rgba(var(--color-primary-rgb, 139, 127, 255), 0.05) 0px, transparent 50%),
        radial-gradient(at 80% 80%, rgba(var(--color-secondary-rgb, 255, 126, 182), 0.05) 0px, transparent 50%);
    color: var(--color-text-primary, #f8f9fa);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease;
}

/* Header - Modern Glass Morphism */
header {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

/* Ensure theme picker stays on right when in header */
.header-content > .theme-picker {
    flex-shrink: 0;
    order: 99; /* Push to end */
}

h1 {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

h2 {
    font-family: 'Crimson Text', serif;
    font-weight: 600;
    letter-spacing: -0.01em;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    font-weight: 500;
    position: relative;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent-primary);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

nav a:hover {
    color: var(--text-primary);
    background: rgba(var(--color-primary-rgb, 139, 127, 255), 0.1);
}

nav a:hover::after {
    width: 60%;
}

/* Search - Modern Style */
.search-container {
    width: 100%;
    max-width: 700px;
    margin: 2.5rem auto;
    padding: 0 1rem;
}

#searchBox {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#searchBox:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 4px 20px rgba(var(--color-primary-rgb, 139, 127, 255), 0.2);
    background: var(--bg-card-hover);
}

#searchBox::placeholder {
    color: var(--text-muted);
}

/* Main Content */
main {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem 4rem;
}

.intro {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    padding: 2.5rem;
    border-radius: 16px;
    margin-bottom: 3rem;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.intro h2 {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    font-size: 2rem;
}

.intro p {
    color: var(--text-secondary);
    line-height: 1.8;
}

/* Grid Layouts - More breathing room */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

/* Cards - Modern Elevated Design */
.card {
    background: var(--bg-card);
    padding: 1.75rem;
    border-radius: 16px;
    border: 1px solid var(--border-primary);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    opacity: 0;
    transition: opacity 0.4s ease;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(var(--color-primary-rgb, 139, 127, 255), 0.15);
    border-color: var(--border-accent);
    background: var(--bg-card-hover);
}

.card:hover::before {
    opacity: 1;
}

.card h3 {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    font-size: 1.35rem;
    font-weight: 600;
}

.card .subtitle {
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.card .description {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.card .attributes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

/* Tags - Modern pill style */
.tag {
    background: rgba(var(--color-primary-rgb, 139, 127, 255), 0.15);
    color: var(--accent-primary);
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid rgba(var(--color-primary-rgb, 139, 127, 255), 0.3);
    transition: all 0.3s ease;
}

.tag:hover {
    background: rgba(var(--color-primary-rgb, 139, 127, 255), 0.25);
    transform: translateY(-1px);
}

/* Sefirot Specific */
.sefirah-card .position {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(var(--color-primary-rgb, 139, 127, 255), 0.3);
}

/* World Specific - Gradient borders */
.world-card[data-world="atziluth"] {
    border-image: var(--atziluth-gradient) 1;
    border-width: 2px;
    border-style: solid;
}

.world-card[data-world="atziluth"]:hover {
    box-shadow: 0 12px 40px rgba(243, 108, 124, 0.2);
}

.world-card[data-world="beriah"] {
    border-image: var(--beriah-gradient) 1;
    border-width: 2px;
    border-style: solid;
}

.world-card[data-world="beriah"]:hover {
    box-shadow: 0 12px 40px rgba(47, 162, 254, 0.2);
}

.world-card[data-world="yetzirah"] {
    border-image: var(--yetzirah-gradient) 1;
    border-width: 2px;
    border-style: solid;
}

.world-card[data-world="yetzirah"]:hover {
    box-shadow: 0 12px 40px rgba(61, 241, 167, 0.2);
}

.world-card[data-world="assiah"] {
    border-image: var(--assiah-gradient) 1;
    border-width: 2px;
    border-style: solid;
}

.world-card[data-world="assiah"]:hover {
    box-shadow: 0 12px 40px rgba(251, 176, 111, 0.2);
}

/* Names Grid */
.names-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.name-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-primary);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.name-card:hover {
    transform: translateY(-6px) scale(1.02);
    border-color: var(--border-accent);
    box-shadow: 0 12px 40px rgba(var(--color-primary-rgb, 139, 127, 255), 0.15);
}

.name-card .hebrew {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.name-card .number {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: rgba(var(--color-primary-rgb, 139, 127, 255), 0.2);
    color: var(--accent-primary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(var(--color-primary-rgb, 139, 127, 255), 0.3);
}

/* Citations - Refined style */
.citation {
    background: rgba(var(--color-primary-rgb, 139, 127, 255), 0.08);
    padding: 0.75rem 1.25rem;
    border-left: 3px solid var(--info);
    margin-top: 1.25rem;
    font-size: 0.9rem;
    font-style: italic;
    color: var(--text-muted);
    border-radius: 0 8px 8px 0;
}

/* Breadcrumb - Sleek design */
.breadcrumb {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
}

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

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

/* Detail Page */
.detail-header {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    padding: 2.5rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    position: relative;
}

.detail-header h2 {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2.75rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.detail-section {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.detail-section h3 {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid var(--border-primary);
    padding-bottom: 0.75rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.detail-section h4 {
    color: var(--accent-primary);
    margin-top: 1.5rem;
    font-size: 1.15rem;
    font-weight: 600;
}

/* Related Links - Modern buttons */
.related-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.related-link {
    background: rgba(var(--color-primary-rgb, 139, 127, 255), 0.1);
    padding: 0.85rem 1.5rem;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-primary);
    border: 1px solid rgba(var(--color-primary-rgb, 139, 127, 255), 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 0.95rem;
}

.related-link:hover {
    background: rgba(var(--color-primary-rgb, 139, 127, 255), 0.2);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(var(--color-primary-rgb, 139, 127, 255), 0.2);
    border-color: var(--accent-primary);
}

/* Tables - Modern styling */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.5rem 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

table th {
    background: var(--bg-secondary);
    color: var(--accent-primary);
    font-weight: 600;
    text-align: left;
    padding: 1rem;
    border-bottom: 2px solid var(--border-primary);
}

table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-primary);
}

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

table tr:hover {
    background: var(--bg-card-hover);
}

/* Footer */
footer {
    background: var(--bg-secondary);
    padding: 2.5rem 2rem;
    text-align: center;
    margin-top: 4rem;
    border-top: 1px solid var(--border-primary);
}

footer a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

/* Lists - Better spacing */
ul, ol {
    line-height: 1.8;
    color: var(--text-secondary);
}

ul li::marker {
    color: var(--accent-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    nav ul {
        justify-content: center;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 1.5rem;
    }

    .detail-header h2 {
        font-size: 2rem;
    }

    main {
        padding: 0 1rem 2rem;
    }

    .intro, .detail-header, .detail-section {
        padding: 1.5rem;
    }
}

/* Loading Animation - Smoother */
.loading {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(var(--color-primary-rgb, 139, 127, 255), 0.2);
    border-radius: 50%;
    border-top-color: var(--accent-primary);
    animation: spin 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

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

/* Highlight for search results - Softer */
.highlight {
    background: rgba(var(--color-primary-rgb, 139, 127, 255), 0.25);
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    font-weight: 500;
}

/* Scrollbar - Modern dark theme */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-accent);
    border-radius: 5px;
}

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

/* Selection color */
::selection {
    background: rgba(var(--color-primary-rgb, 139, 127, 255), 0.3);
    color: var(--text-primary);
}

/* Back to top button styling */
.back-to-top {
    box-shadow: 0 8px 24px rgba(var(--color-primary-rgb, 139, 127, 255), 0.3) !important;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)) !important;
}

.back-to-top:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 12px 32px rgba(var(--color-primary-rgb, 139, 127, 255), 0.4) !important;
}
