/* Modern Professional Sidebar Design - V120 */
:root {
    --bg-main: #0f172a;
    --bg-sidebar: #1e293b;
    --primary: #38bdf8;
    /* Sky Blue */
    --accent: #f472b6;
    /* Pink */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --sidebar-width: 280px;
}

[data-theme="light"] {
    --bg-main: #f1f5f9;
    --bg-sidebar: #ffffff;
    --primary: #0284c7;
    /* Darker Blue */
    --accent: #db2777;
    /* Darker Pink */
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: rgba(0, 0, 0, 0.1);
}

[data-theme="gold"] {
    --bg-main: #000000;
    --bg-sidebar: #111111;
    --primary: #ffd700;
    /* Gold */
    --accent: #ff4500;
    /* Orange Red */
    --text-main: #ffffff;
    --text-muted: #a3a3a3;
    --border: rgba(255, 215, 0, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Tajawal', 'Roboto', sans-serif;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-inline-end: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px;
    /* Reduced padding */
    inset-inline-start: 0;
    /* Logical Left/Right */
    z-index: 100;
    transition: background-color 0.3s, border-color 0.3s;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 20px;
}

.logo {
    margin-bottom: 20px;
    /* Reduced margin */
    display: flex;
    justify-content: center;
    align-items: center;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* Reduced gap */
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    transition: 0.3s;
    font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(56, 189, 248, 0.1);
    color: var(--primary);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    margin-top: auto;
}

.lang-btn {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s;
}

.lang-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.theme-switcher {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.theme-btn {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--border);
    transition: 0.3s;
}

.theme-btn:hover {
    transform: scale(1.1);
}

.theme-btn.active {
    border-color: var(--text-main);
    transform: scale(1.2);
}

/* --- Main Content --- */
.main-content {
    margin-inline-start: var(--sidebar-width);
    /* Push content */
    padding: 40px 60px;
    min-height: 100vh;
    transition: 0.3s;
}

/* --- Hero --- */
.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 80vh;
    gap: 50px;
}

.hero-text h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero-text .subtitle {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.hero-text .bio {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.8;
    max-width: 600px;
    margin-bottom: 40px;
}

.stats-row {
    display: flex;
    gap: 40px;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat b {
    font-size: 2rem;
    color: var(--text-main);
}

.stat span {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.hero-img img {
    width: 350px;
    height: 350px;
    object-fit: cover;
    border-radius: 30px;
    border: 2px solid var(--border);
    box-shadow: 20px 20px 0 rgba(56, 189, 248, 0.1);
}

/* --- Sections --- */
.page-section {
    max-width: 1000px;
    margin: 0 auto;
    padding-top: 40px;
    animation: fadeIn 0.5s ease;
}

.page-section h2 {
    font-size: 2.5rem;
    margin-bottom: 40px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 20px;
    display: inline-block;
}

/* --- Grid & Cards --- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
}

.card {
    background: var(--bg-sidebar);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid var(--border);
    transition: 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.media-card {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.media-card i {
    font-size: 3rem;
    color: var(--accent);
}

/* --- Timeline --- */
.timeline {
    position: relative;
    border-inline-start: 2px solid var(--border);
    padding-inline-start: 30px;
}

.timeline-item {
    position: relative;
    margin-bottom: 40px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    top: 5px;
    inset-inline-start: -36px;
    /* 30px padding + 2px border + 4px center */
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
}

.year {
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 5px;
}

.content h3 {
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.content p {
    color: var(--text-muted);
}

/* --- Contact --- */
.contact-section {
    text-align: center;
}

.contact-section h2 {
    margin-inline: auto;
    /* Ensure centered if block, though inline-block centers via parent */
}

.contact-card {
    background: var(--bg-sidebar);
    padding: 50px;
    border-radius: 30px;
    text-align: center;
    border: 1px solid var(--border);
    max-width: 800px;
    /* Optional: Constrain width for better look on large screens */
    margin-inline: auto;
    /* Force center horizontally in RTL/LTR */
    width: 100%;
    /* Ensure it takes width up to max-width */
}

.contact-card p {
    font-size: 1.5rem;
    margin-bottom: 30px;
}

.social-icons {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.social-icons a {
    font-size: 2rem;
    color: var(--text-muted);
    transition: 0.3s;
}

.social-icons a:hover {
    color: var(--primary);
}

/* --- Mobile Nav --- */
.mobile-nav {
    display: none;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-inline-start: 0;
        padding: 20px 15px 80px;
        /* Smaller padding */
    }

    .hero {
        flex-direction: column-reverse;
        text-align: center;
        justify-content: center;
        gap: 30px;
        min-height: auto;
        padding-top: 40px;
    }

    .hero-text h1 {
        font-size: 2.2rem;
        /* Reduce form 3.5rem */
    }

    .hero-text .subtitle {
        font-size: 1.2rem;
    }

    .hero-img img {
        width: 200px;
        height: 200px;
        margin: 0 auto;
    }

    .stats-row {
        justify-content: center;
        gap: 20px;
        flex-wrap: wrap;
        /* Allow wrapping */
    }

    .grid {
        gap: 20px;
        grid-template-columns: 1fr;
        /* Force single column on very small screens */
    }

    .card {
        padding: 20px;
        /* Reduce padding */
    }

    .page-section h2 {
        font-size: 1.8rem;
    }

    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-sidebar);
        padding: 10px;
        justify-content: space-around;
        border-top: 1px solid var(--border);
        z-index: 1000;
        box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.1);
    }

    .mobile-item {
        color: var(--text-muted);
        font-size: 1.4rem;
        padding: 10px;
        transition: 0.3s;
    }

    .mobile-item.active {
        color: var(--primary);
    }

    /* Mobile Article Optimization */
    .bio-content-formatted {
        font-size: 18px !important;
        line-height: 1.8 !important;
    }

    .bio-content-formatted p,
    .bio-content-formatted li {
        text-align: justify;
        margin-bottom: 20px;
    }

    .bio-content-formatted h3 {
        font-size: 1.4rem;
        margin-top: 35px;
        margin-bottom: 15px;
        color: var(--primary);
    }

    .bio-content-formatted img {
        max-width: 100% !important;
        height: auto !important;
        border-radius: 8px;
        margin: 20px auto;
        display: block;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Blog Section --- */
.blog-card {
    text-decoration: none;
    color: inherit;
    display: block;
}

.blog-thumb {
    height: 180px;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    margin-bottom: 15px;
    background-color: var(--bg-main);
}

.blog-card h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    line-height: 1.4;
}

.blog-card span {
    color: var(--primary);
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* --- Footer --- */
.main-footer {
    text-align: center;
    padding: 40px 20px;
    margin-top: 60px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* --- Album Section --- */
.album-card {
    padding: 0;
    overflow: hidden;
    cursor: pointer;
}

.album-card img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: 0.5s;
}

.album-card:hover img {
    transform: scale(1.1);
}

/* --- Scroll to Top --- */
#scrollTopBtn {
    display: none;
    position: fixed;
    bottom: 30px;
    inset-inline-end: 30px;
    /* Logical Right/Left */
    z-index: 999;
    font-size: 18px;
    border: none;
    outline: none;
    background-color: var(--primary);
    color: var(--bg-main);
    cursor: pointer;
    padding: 15px;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: 0.3s;
}

#scrollTopBtn:hover {
    background-color: var(--accent);
    transform: translateY(-5px);
}

/* --- Accessibility Widget --- */
.accessibility-widget {
    position: fixed;
    bottom: 90px;
    /* Stacked above scroll button */
    inset-inline-end: 30px;
    /* Logical Right/Left */
    z-index: 1000;
}

#accessBtn {
    background-color: var(--bg-sidebar);
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: 0.3s;
}

#accessBtn:hover {
    transform: scale(1.1);
    background-color: var(--primary);
    color: var(--bg-sidebar);
}

.access-panel {
    display: none;
    position: absolute;
    bottom: 70px;
    /* Shifted up */
    inset-inline-end: 0;
    /* Align to end */
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border);
    padding: 15px;
    border-radius: 10px;
    width: 200px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.access-panel.show {
    display: block;
    animation: fadeIn 0.3s;
}

.access-panel h3 {
    margin-bottom: 10px;
    font-size: 1rem;
    color: var(--primary);
    text-align: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
}

/* Access Panel Theme Switcher */
.access-theme-options {
    text-align: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}

.theme-switcher {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 5px;
}

.access-panel button {
    display: block;
    width: 100%;
    padding: 8px;
    margin-bottom: 5px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    cursor: pointer;
    border-radius: 5px;
    text-align: left;
    transition: 0.2s;
}

.access-panel button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.access-panel button i {
    width: 20px;
    margin-right: 5px;
}

.access-panel .reset-btn {
    background-color: rgba(244, 114, 182, 0.2);
    color: var(--accent);
    border-color: var(--accent);
    text-align: center;
}

/* --- Accessibility Modes --- */
body.large-text {
    font-size: 120%;
}

body.gray-mode .sidebar,
body.gray-mode .main-content,
body.gray-mode .mobile-nav,
body.gray-mode .accessibility-widget,
body.gray-mode #scrollTopBtn {
    filter: grayscale(100%);
}

body.high-contrast {
    --bg-main: #000000 !important;
    --bg-sidebar: #000000 !important;
    --text-main: #ffff00 !important;
    /* Yellow */
    --text-muted: #ffffff !important;
    --primary: #ffff00 !important;
    --accent: #ffffff !important;
    --border: #ffffff !important;
}

body.high-contrast * {
    background-color: #000000 !important;
    color: #ffff00 !important;
    border-color: #ffffff !important;
}

body.underline-links a {
    text-decoration: underline !important;
}

@media (max-width: 900px) {
    #scrollTopBtn {
        bottom: 90px;
        /* Above mobile nav */
    }

    .accessibility-widget {
        bottom: 150px;
        /* Above scroll button */
    }
}

/* --- News Ticker --- */
#news-ticker-container {
    background-color: var(--primary);
    color: var(--bg-main);
    overflow: hidden;
    height: 40px;
    position: relative;
    width: 100%;
    z-index: 99;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.ticker-wrap {
    width: 100%;
    padding-bottom: 5px;
}

.access-panel button {
    display: block;
    width: 100%;
    padding: 8px;
    margin-bottom: 5px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    cursor: pointer;
    border-radius: 5px;
    text-align: left;
    transition: 0.2s;
}

.access-panel button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.access-panel button i {
    width: 20px;
    margin-right: 5px;
}

.access-panel .reset-btn {
    background-color: rgba(244, 114, 182, 0.2);
    color: var(--accent);
    border-color: var(--accent);
    text-align: center;
}

/* --- Accessibility Modes --- */
body.large-text {
    font-size: 120%;
}

body.gray-mode .sidebar,
body.gray-mode .main-content,
body.gray-mode .mobile-nav,
body.gray-mode .accessibility-widget,
body.gray-mode #scrollTopBtn {
    filter: grayscale(100%);
}

body.high-contrast {
    --bg-main: #000000 !important;
    --bg-sidebar: #000000 !important;
    --text-main: #ffff00 !important;
    /* Yellow */
    --text-muted: #ffffff !important;
    --primary: #ffff00 !important;
    --accent: #ffffff !important;
    --border: #ffffff !important;
}

body.high-contrast * {
    background-color: #000000 !important;
    color: #ffff00 !important;
    border-color: #ffffff !important;
}

body.underline-links a {
    text-decoration: underline !important;
}

@media (max-width: 900px) {
    #scrollTopBtn {
        bottom: 90px;
        /* Above mobile nav */
    }

    .accessibility-widget {
        bottom: 150px;
        /* Above scroll button */
    }
}

/* --- Notification Bar --- */
#notification-bar {
    background-color: var(--primary);
    color: var(--bg-main);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 40px;
    position: relative;
    width: 100%;
    z-index: 99;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    font-weight: bold;
    text-align: center;
}

.notification-content {
    flex: 1;
    font-size: 1rem;
}

.notification-close {
    position: absolute;
    inset-inline-end: 20px;
    background: rgba(0, 0, 0, 0.1);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s;
    font-size: 1.2rem;
    line-height: 1;
}

.notification-close:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* --- Search Overlay --- */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: none;
    flex-direction: column;
    align-items: center;
    padding-top: 100px;
    opacity: 0;
    transition: opacity 0.3s;
}

.search-overlay.active {
    display: flex;
    opacity: 1;
}

.search-container {
    width: 90%;
    max-width: 800px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 20px 60px 20px 20px;
    font-size: 2rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--border);
    color: var(--text-main);
    outline: none;
    text-align: center;
    font-family: inherit;
}

.search-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 3rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.3s;
}

.search-close:hover {
    color: var(--accent);
    transform: rotate(90deg);
}

.search-results {
    width: 90%;
    max-width: 800px;
    margin-top: 40px;
    overflow-y: auto;
    max-height: 60vh;
    padding-bottom: 50px;
}

.search-result-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: 0.2s;
    border: 1px solid transparent;
}

.search-result-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

.search-result-item h4 {
    color: var(--primary);
    margin-bottom: 5px;
    font-size: 1.2rem;
}

.search-result-item p {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-result-type {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.6;
    margin-bottom: 5px;
    display: block;
}

/* --- Bio Content Images (Responsive) --- */
.bio-content-formatted img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* --- Premium Share Buttons --- */
.share-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border: none;
    cursor: pointer;
    background: white;
}

/* --- Share Icons Header (Minimal) --- */
.share-icons-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.share-icons-header a,
.share-icons-header button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: 0.3s;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.share-icons-header a:hover,
.share-icons-header button:hover {
    color: var(--primary);
    transform: translateY(-2px);
}