/* ============================================
   The Arcane Library - Main Stylesheet
   Dark modern theme with purple accents
   ============================================ */

/* === CSS VARIABLES === */
:root {
    /* Colors inspired by reference image */
    --bg-dark: #0a0e1a;
    --bg-darker: #06090f;
    --bg-card: #151b2e;
    --bg-card-hover: #1a2332;
    
    --primary: #7c7cff;
    --primary-light: #a8a8ff;
    --primary-dark: #5c5cd9;
    --accent: #b8b8ff;
    
    --text-primary: #e6e6e6;
    --text-secondary: #a8b2c8;
    --text-muted: #6b7b9e;
    
    --border: #2a3447;
    --border-light: #3d4a5f;
    
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #f44336;
    --info: #2196f3;
    
    --glow: 0 0 20px rgba(124, 124, 255, 0.3);
    --glow-strong: 0 0 30px rgba(124, 124, 255, 0.5);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.4);
    
    /* Layout */
    --sidebar-width: 280px;
    --header-height: 70px;
    
    /* Typography */
    --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'Courier New', monospace;
}

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    line-height: 1.2;
    font-weight: 600;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent);
}

/* === LAYOUT === */
.layout {
    display: flex;
    min-height: 100vh;
}

/* === SIDEBAR === */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-darker);
    border-right: 1px solid var(--border);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.site-logo-icon {
    font-size: 2rem;
    filter: drop-shadow(var(--glow));
}

.site-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
    text-shadow: var(--glow);
}

.site-tagline {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    padding: 0.5rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.nav-items {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    border-left-color: var(--primary);
}

.nav-link.active {
    background: var(--bg-card);
    color: var(--accent);
    border-left-color: var(--primary);
    box-shadow: inset 0 0 10px rgba(124, 124, 255, 0.1);
}

.nav-link.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.nav-link.disabled:hover {
    background: transparent;
    color: var(--text-secondary);
    border-left-color: transparent;
}

.nav-icon {
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
}

.nav-badge {
    margin-left: auto;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    background: var(--primary);
    border-radius: 10px;
    color: white;
}

/* Nested nav items */
.nav-children {
    list-style: none;
    margin-top: 0.25rem;
}

.nav-children .nav-link {
    padding-left: 3.5rem;
    font-size: 0.9rem;
}

/* === MAIN CONTENT === */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    background: var(--bg-dark);
}

.content-header {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-darker) 100%);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow);
}

.content-title {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 0.25rem;
    text-shadow: var(--glow);
}

.content-description {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.breadcrumb {
    display: flex;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.breadcrumb-separator {
    color: var(--text-muted);
}

.content-body {
    padding: 2rem;
}

/* === CARDS === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.card:hover {
    background: var(--bg-card-hover);
    box-shadow: var(--glow);
    border-color: var(--primary);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1.25rem;
    color: var(--primary-light);
}

.card-body {
    color: var(--text-secondary);
}

/* === TABLES === */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

thead {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: white;
    border-bottom: 2px solid var(--primary);
}

td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

tbody tr {
    transition: background 0.2s;
}

tbody tr:hover {
    background: var(--bg-card-hover);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    background: var(--primary);
    color: white;
}

.btn:hover {
    background: var(--primary-light);
    box-shadow: var(--glow);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
}

.btn-success {
    background: var(--success);
}

.btn-warning {
    background: var(--warning);
}

.btn-danger {
    background: var(--danger);
}

/* === FORMS === */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-darker);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 124, 255, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* === SEARCH === */
.search-box {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    background: var(--bg-darker);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* === BADGES === */
.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-primary { background: var(--primary); color: white; }
.badge-success { background: var(--success); color: white; }
.badge-warning { background: var(--warning); color: white; }
.badge-danger { background: var(--danger); color: white; }
.badge-info { background: var(--info); color: white; }

/* === ALERTS === */
.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-info {
    background: rgba(33, 150, 243, 0.1);
    border-left-color: var(--info);
    color: var(--text-secondary);
}

.alert-success {
    background: rgba(76, 175, 80, 0.1);
    border-left-color: var(--success);
    color: var(--text-secondary);
}

.alert-warning {
    background: rgba(255, 152, 0, 0.1);
    border-left-color: var(--warning);
    color: var(--text-secondary);
}

.alert-danger {
    background: rgba(244, 67, 54, 0.1);
    border-left-color: var(--danger);
    color: var(--text-secondary);
}

/* === DICE NOTATION === */
.dice-notation {
    font-family: var(--font-mono);
    background: var(--bg-darker);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    color: var(--primary-light);
    border: 1px solid var(--border);
}

/* === GRID === */
.grid {
    display: grid;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* === UTILITIES === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary-light); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* === MOBILE SIDEBAR === */
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg), var(--glow);
    z-index: 200;
    transition: all 0.3s;
}

.sidebar-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg), var(--glow-strong);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
        width: 280px;
        box-shadow: var(--shadow-lg);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .content-header {
        padding: 1rem;
    }
    
    .content-title {
        font-size: 1.5rem;
    }
    
    .content-body {
        padding: 1rem;
    }
    
    table {
        font-size: 0.85rem;
    }
    
    th, td {
        padding: 0.5rem 0.3rem;
    }
    
    .grid {
        grid-template-columns: 1fr !important;
    }
}

/* === SCROLLBAR STYLING === */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* === ANIMATIONS === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.main-content.full-width {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 1rem;
    padding-right: 1rem;
}

body.embed-mode .sidebar {
    display: none !important;
}

body.embed-mode .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

body.embed-mode .sidebar {
    display: none !important;
}

/* Footer Positioning Fix
 * Add this to your main CSS file
 * This ensures footer stays in the main content area, not under sidebar
 */

/* Layout structure */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    overflow-y: auto;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    z-index: 1000;
}

.main-content {
    margin-left: 250px;
    width: calc(100% - 250px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-body {
    flex: 1; /* Takes up remaining space, pushing footer to bottom */
}

/* Footer stays in main content area */
.site-footer {
    background: var(--bg-darker);
    border-top: 1px solid var(--border);
    padding: 1.5rem 2rem;
    margin-top: auto; /* Pushes to bottom */
    width: 100%; /* Full width of main-content, NOT viewport */
}

/* Embed mode - full width */
body.embed-mode .main-content {
    margin-left: 0;
    width: 100%;
}

body.embed-mode .sidebar {
    display: none;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
}