/* ══════════════════════════════════════════════════════════════════════════════
   Shared Layout — identical sidebar + page structure for all services
   Loaded via /static/css/layout.css (served by main_site, both services use it)

   Required CSS variables (each service defines in its own CSS):
     --bg-main, --bg-card, --bg-hover
     --text-primary, --text-secondary, --text-muted
     --accent, --accent-hover
     --border
     --shadow-sm, --shadow-md, --shadow-lg
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Layout Variables ─────────────────────────────────────────────────────── */
:root {
    --sidebar-width: 280px;
    --content-max-width: 1100px;
    --page-max-width: calc(var(--sidebar-width) + var(--content-max-width) + 4rem);
    --top-bar-height: 56px;
}

/* ── Body Layout ──────────────────────────────────────────────────────────── */
body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

/* ── Page Wrapper ─────────────────────────────────────────────────────────── */
.page-wrapper {
    display: flex;
    width: 100%;
    max-width: var(--page-max-width);
    margin: 0 auto;
    padding: 0 2rem;
    box-sizing: border-box;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-card);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    border-right: 1px solid var(--border);
    z-index: 100;
    box-sizing: border-box;
    transition: background 0.3s ease, border-color 0.3s ease;
    flex-shrink: 0;
}

.sidebar > * { flex-shrink: 0; }

/* ── Sidebar Close Button (mobile only) ───────────────────────────────────── */
.sidebar-close-btn {
    display: none;
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}
.sidebar-close-btn button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.4rem;
    border-radius: 6px;
}
.sidebar-close-btn button:hover { background: var(--bg-hover); }

/* ── Profile Image ────────────────────────────────────────────────────────── */
.profile-img {
    width: 160px;
    height: 160px;
    border-radius: 8px;
    margin: 0 auto 1.5rem;
    border: 3px solid var(--accent);
    overflow: hidden;
}
.profile-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Navigation Menu ──────────────────────────────────────────────────────── */
.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
}
.nav-menu li { margin-bottom: 0.5rem; }
.nav-menu a {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: 6px;
    transition: all 0.2s ease-in-out;
    font-weight: 500;
    font-size: 0.95rem;
}
.nav-menu a:hover,
.nav-menu a.active {
    background: var(--accent);
    color: white !important;
    box-shadow: var(--shadow-sm);
    transform: translateX(3px);
}

/* ── Section Titles ───────────────────────────────────────────────────────── */
.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin: 1.5rem 1rem 0.5rem;
    font-weight: 700;
}

/* ── Pet Projects Nav ─────────────────────────────────────────────────────── */
.nav-menu.pet-projects a {
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
}
.nav-menu.pet-projects a::before {
    content: "\2192";
    margin-right: 8px;
    font-size: 0.9rem;
    color: var(--accent);
    opacity: 0.7;
    transition: transform 0.2s;
}
.nav-menu.pet-projects a:hover::before {
    transform: translateX(3px);
    opacity: 1;
}

/* ── Admin Nav ────────────────────────────────────────────────────────────── */
.nav-menu.admin-nav a {
    font-size: 0.85rem;
    padding: 0.55rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.nav-menu.admin-nav a .material-icons-outlined { font-size: 1.1rem; }

/* ── Lang Switcher ────────────────────────────────────────────────────────── */
.lang-switcher {
    padding: 0.5rem 1rem;
    display: flex;
    gap: 0.5rem;
}
.lang-btn {
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.lang-btn.active {
    background: var(--accent);
    color: white;
}

/* ── Theme Switcher ───────────────────────────────────────────────────────── */
.theme-switcher-container {
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.theme-switcher {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.theme-switcher input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}
body.dark-mode .slider { background-color: #555; }
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider { background-color: var(--accent); }
input:checked + .slider:before { transform: translateX(20px); }

/* ── Contact Info ─────────────────────────────────────────────────────────── */
.contact-info {
    margin-top: 1rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    transition: border-color 0.3s ease;
}
.contact-info p {
    margin: 0.75rem 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}
.contact-info p svg {
    width: 1em;
    height: 1em;
    margin-right: 8px;
    fill: currentColor;
    vertical-align: middle;
}
.contact-info a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease-in-out;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
}
.contact-info a:hover { color: var(--accent-hover); }

/* ── Sidebar User Section ─────────────────────────────────────────────────── */
.sidebar-user-section {
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}
.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0;
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.sidebar-user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sidebar-user-email {
    font-size: 0.78rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-user-link { font-size: 0.75rem; color: var(--accent); }
.sidebar-logout { font-size: 0.75rem; color: var(--text-muted); }
.sidebar-logout:hover { color: var(--accent); }
.sidebar-login-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    background: var(--accent);
    color: #fff;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.3s ease;
    justify-content: center;
}
.sidebar-login-btn:hover { background: var(--accent-hover); color: #fff; }

/* ── Main Content ─────────────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    padding: 2.5rem;
    box-sizing: border-box;
    overflow-x: hidden;
    max-width: var(--content-max-width);
}

/* ── Mobile Top Bar ───────────────────────────────────────────────────────── */
.mobile-top-bar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--top-bar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    padding: 0 1rem;
    align-items: center;
    gap: 0.75rem;
    transition: background 0.3s ease, border 0.3s ease;
}
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-primary);
}
.logo-icon { font-size: 1.5rem; color: var(--accent); }

.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0);
    z-index: 98;
    pointer-events: none;
    transition: background 0.3s;
}
.mobile-overlay.show {
    background: rgba(0,0,0,0.4);
    pointer-events: all;
}

/* ── Hamburger ────────────────────────────────────────────────────────────── */
.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    padding: 0.4rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}
.hamburger:hover { background: var(--bg-hover); }
.hamburger .material-icons-outlined { font-size: 1.5rem; }
