/* =============================================================
   SHARED.CSS — Common styles for kanibal.dev (root + /tools)
   ============================================================= */

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

/* --- Color Variables --- */
:root {
    --background-primary: #121212;
    --background-secondary: #181818;
    --border-color: #333333;

    --primary-purple: #be47f5;
    --primary-glow: rgba(222, 78, 241, 0.45);

    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;

    /* Extended palette */
    --text-muted: #888;
    --text-dimmed: #666;
    --text-faint: #aaa;
    --text-light: #ccc;
    --bg-elevated: #2a2a2a;
    --bg-sunken: #0d0d0d;
}

/* --- Body & Background Gradient --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background-primary);
    color: var(--text-primary);
    padding-left: 200px;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle at 100% 0%, rgba(147, 51, 234, 0.15) 0%, transparent 50%),
                      radial-gradient(circle at 0% 100%, rgba(59, 130, 246, 0.15) 0%, transparent 50%);
    z-index: 0;
    mix-blend-mode: screen;
}

/* --- Sidebar --- */
.sidebar {
    width: 200px;
    background: rgba(24, 24, 24, 0.35);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--bg-elevated);
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 10;
    user-select: none;
}

.profile {
    margin-bottom: 30px;
}

.profile-pic {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-elevated);
    margin-bottom: 10px;
    background-image: url('/images/profile_photo.avif');
    background-size: cover;
    background-position: center;
}

.profile h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.profile p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.nav-section {
    margin-bottom: 30px;
}

.nav-section h4 {
    font-size: 11px;
    color: var(--text-dimmed);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    font-weight: 600;
}

.nav-item {
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--bg-elevated);
}

.nav-item.active {
    color: var(--primary-purple);
    background: rgba(147, 51, 234, 0.1);
}

.nav-icon {
    font-size: 16px;
}

/* --- Main Content --- */
.main-content {
    margin: 0 auto;
    width: 100%;
    max-width: 900px;
    padding: 60px 80px;
    position: relative;
    z-index: 2;
}

/* Decorative vertical lines */
.main-content::before,
.main-content::after {
    content: '';
    position: fixed;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(transparent, var(--border-color) 5%, var(--border-color) 95%, transparent);
    z-index: 1;
}

.main-content::before {
    left: calc(50vw + 100px - 450px);
    box-shadow: 0 0 15px 3px rgba(147, 51, 234, 0.1);
}

.main-content::after {
    left: calc(50vw + 100px + 450px);
    box-shadow: 0 0 15px 3px rgba(147, 51, 234, 0.1);
}

/* --- Header --- */
.header {
    margin-bottom: 60px;
    text-align: center;
}

.header h1 {
    font-size: 48px;
    font-weight: 600;
    margin-bottom: 15px;
}

.header h1 .name {
    color: var(--primary-purple);
    text-shadow: 0 0 10px var(--primary-glow);
}

.header h1 .divider {
    color: #444;
    margin: 0 15px;
}

.header h1 .title {
    color: var(--text-muted);
    font-weight: 400;
}

.header p {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 25px;
}

/* --- Sections --- */
.section {
    margin-bottom: 60px;
}

.section h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 30px;
}

/* --- Text Glow --- */
.text-glow {
    color: var(--primary-purple);
    text-shadow: 0 0 10px var(--primary-glow);
    font-weight: 500;
}

/* --- Page Transition Animations --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-15px); }
}

.page-section.fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

.page-section.fade-out {
    animation: fadeOut 0.3s ease-in forwards;
}

/* --- SVG Icon Base --- */
.icon-svg {
    width: 30px;
    height: 30px;
    vertical-align: middle;
    transition: all 0.3s ease;
}

/* Sidebar icon sizing (filters are set per-page) */
.nav-icon .icon-svg {
    width: 20px;
    height: 20px;
}

/* Active sidebar icon — purple (shared across all pages) */
.nav-item.active .icon-svg {
    filter: invert(29%) sepia(99%) saturate(3431%) hue-rotate(270deg) brightness(92%) contrast(96%);
}

/* --- Back Button --- */
.back-btn {
    display: inline-block;
    margin-bottom: 25px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    text-decoration: none;
    transition: color 0.2s;
}

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

/* --- Action Button --- */
.action-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    background-color: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.action-button:has(img) {
    padding: 1px 20px;
}

.action-button:hover {
    border-color: var(--primary-purple);
    color: var(--primary-purple);
    transform: translateY(-2px);
    box-shadow: 0 0 15px var(--primary-glow);
}

.action-button-container {
    text-align: center;
}

/* --- Section Divider --- */
.section-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 20px auto 40px;
    width: 50%;
}

/* --- Footer Clock --- */
.footer-clock {
    position: fixed;
    bottom: 20px;
    left: 20px;
    font-size: 13px;
    color: var(--text-dimmed);
}

.footer-clock div {
    margin-bottom: 2px;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 10px;
}

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

::-webkit-scrollbar-thumb {
    background-color: #4a4a4a;
    border-radius: 10px;
    border: 2px solid var(--background-secondary);
}

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

/* --- Page Loader --- */
#pageLoader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background-primary);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#pageLoader.loaded {
    opacity: 0;
    visibility: hidden;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* --- Back to Top Button (hidden on desktop, shown on mobile) --- */
#backToTop {
    display: none;
}

/* --- Hamburger & Overlay (hidden on desktop) --- */
.hamburger-btn {
    display: none;
}

.sidebar-overlay {
    display: none;
}

/* =============================================================
   RESPONSIVE / MOBILE (max-width: 768px)
   ============================================================= */
@media (max-width: 768px) {

    body {
        padding-left: 0 !important;
    }

    /* Hamburger Button */
    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1001;
        background: rgba(24, 24, 24, 0.8);
        color: var(--text-primary);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        width: 45px;
        height: 45px;
        font-size: 24px;
        cursor: pointer;
        backdrop-filter: blur(10px);
        transition: all 0.2s ease;
        line-height: 1;
        padding-bottom: 2px;
    }

    .hamburger-btn:hover {
        border-color: var(--primary-purple);
        color: var(--primary-purple);
        box-shadow: 0 0 10px var(--primary-glow);
    }

    /* Sidebar Drawer */
    .sidebar {
        width: 260px;
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1002;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.5);
    }

    .sidebar.mobile-active {
        transform: translateX(0);
    }

    /* Overlay */
    .sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(3px);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Main Content */
    .main-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 80px 20px 40px 20px;
    }

    .main-content::before,
    .main-content::after {
        display: none !important;
    }

    /* Hide clock on mobile (sidebar is hidden) */
    .footer-clock {
        display: none;
    }

    .header h1 {
        font-size: 32px;
    }

    /* Back to Top — visible on mobile only */
    #backToTop {
        display: block;
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 100;
        width: 45px;
        height: 45px;
        border-radius: 50%;
        background: rgba(24, 24, 24, 0.8);
        color: var(--text-primary);
        border: 1px solid var(--border-color);
        font-size: 20px;
        cursor: pointer;
        backdrop-filter: blur(10px);
        transition: all 0.3s ease;
        opacity: 0;
        visibility: hidden;
        transform: translateY(10px);
    }

    #backToTop.visible {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    #backToTop:hover {
        border-color: var(--primary-purple);
        color: var(--primary-purple);
        box-shadow: 0 0 10px var(--primary-glow);
    }
}
