/* ==========================================================================
   Huntarr Sidebar - Redesigned
   All sidebar styling lives here. No inline styles in sidebar.html.
   ========================================================================== */

/* Wrapper for all sidebars — desktop: layout flow; mobile: moved into drawer */
.sidebar-wrapper {
    display: flex;
    flex-shrink: 0;
}

/* ===== SIDEBAR CORE ===== */
.sidebar {
    width: 220px;
    height: 100vh;
    background: linear-gradient(180deg,
        rgba(16, 21, 32, 0.99) 0%,
        rgba(12, 17, 28, 0.99) 50%,
        rgba(14, 19, 30, 0.99) 100%
    );
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}

/* Custom scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ===== ANIMATED EDGE LINE — indigo ===== */
/* z-index above footer so line runs full height, not cut off */
.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg,
        rgba(99, 102, 241, 0.15) 0%,
        rgba(99, 102, 241, 0.5) 20%,
        #6366f1 40%,
        #818cf8 50%,
        #6366f1 60%,
        rgba(99, 102, 241, 0.5) 80%,
        rgba(99, 102, 241, 0.15) 100%
    );
    background-size: 100% 100%;
    z-index: 1003;
    opacity: 0.85;
    pointer-events: none;
}


/* ===== LOGO SECTION ===== */
.logo-container {
    display: flex;
    align-items: center;
    padding: 16px 18px 14px;
    position: relative;
    flex-shrink: 0;
}

.logo-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 18px;
    right: 18px;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.06),
        transparent
    );
}

.logo {
    width: 42px;
    height: 42px;
    margin-right: 12px;
    border-radius: 12px;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.3));
}

.logo-small {
    display: none;
}

.logo-container h1 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: #e8ecf2;
    letter-spacing: 0.5px;
}

/* ===== NAV MENU ===== */
.nav-menu {
    display: flex;
    flex-direction: column;
    padding: 8px 0 40px 0;
    flex-grow: 1;
}

/* Heart icon */
.heart-icon {
    color: #e74c3c !important;
    background: transparent !important;
    border: none !important;
}

.heart-icon i {
    color: #ff4d6d;
}

/* ===== HOME STANDALONE ITEM ===== */
.nav-item-home {
    margin: 6px 10px 2px !important;
}

.nav-item-home .nav-icon-wrapper {
    width: 20px;
    height: 20px;
    margin-right: 8px;
}

.nav-item-home .nav-icon-wrapper i {
    font-size: 13px;
}

/* ===== NAV GROUPS ===== */
.nav-group {
    margin: 0 0 2px 0;
    padding: 0;
}

/* Static group title (Daughter's Sponsors) */
.nav-group-title {
    font-size: 10px;
    font-weight: 700;
    color: rgba(148, 163, 184, 0.6);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 12px 20px 6px;
    margin: 0;
    user-select: none;
}

/* ===== COLLAPSIBLE GROUP HEADERS ===== */
.nav-group-header {
    display: flex;
    align-items: center;
    padding: 7px 12px;
    margin: 1px 10px;
    border-radius: 8px;
    color: rgba(148, 163, 184, 0.7);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.nav-group-header:hover {
    background: rgba(99, 102, 241, 0.06);
    color: rgba(203, 213, 225, 0.9);
}

.nav-group-header .nav-group-icon {
    font-size: 12px;
    width: 20px;
    margin-right: 8px;
    text-align: center;
    opacity: 0.6;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.nav-group-header:hover .nav-group-icon {
    opacity: 0.9;
}

.nav-group-header span {
    flex: 1;
}

/* Chevron arrow — rotates when expanded */
.nav-group-chevron {
    font-size: 10px;
    opacity: 0.4;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

.nav-group-header:hover .nav-group-chevron {
    opacity: 0.7;
}

.nav-group-header.expanded .nav-group-chevron {
    transform: rotate(90deg);
    opacity: 0.8;
}

/* Expanded header gets accent tint */
.nav-group-header.expanded {
    color: rgba(165, 180, 252, 0.8);
    background: rgba(99, 102, 241, 0.04);
}

.nav-group-header.expanded .nav-group-icon {
    color: rgba(165, 180, 252, 0.8);
    opacity: 0.8;
}

/* ===== COLLAPSIBLE GROUP BODY ===== */
.nav-group-body {
    overflow: hidden;
    max-height: 800px; /* large enough for fully expanded content */
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s ease;
    opacity: 1;
    padding: 2px 0;
}

.nav-group-body.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0;
}

/* ===== NAV ITEMS ===== */
.nav-item {
    display: flex;
    align-items: center;
    padding: 0 12px;
    height: 36px;
    color: rgba(203, 213, 225, 0.8);
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    margin: 1px 10px;
    position: relative;
    cursor: pointer;
}

.nav-item span {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Icon wrapper */
.nav-icon-wrapper {
    width: 28px;
    height: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 10px;
    flex-shrink: 0;
    border-radius: 7px;
    transition: all 0.2s ease;
    background: transparent;
    border: none;
    position: relative;
}

.nav-icon-wrapper i {
    font-size: 14px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.2s ease;
    color: rgba(148, 163, 184, 0.7);
}

/* ===== HOVER STATE ===== */
.nav-item:hover {
    background: rgba(99, 102, 241, 0.06);
    color: #e2e8f0;
    transform: none;
    text-decoration: none;
}

.nav-item:hover .nav-icon-wrapper i {
    color: #94a3b8;
}

/* ===== ACTIVE STATE — indigo ===== */
.nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
    box-shadow: none;
    transform: none;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #6366f1;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

.nav-item.active .nav-icon-wrapper {
    background: transparent;
    border: none;
    transform: none;
}

.nav-item.active .nav-icon-wrapper i,
.nav-item.active i {
    color: #a5b4fc;
    filter: drop-shadow(0 0 3px rgba(99, 102, 241, 0.4));
}

.nav-item.active span {
    font-weight: 600;
    color: #a5b4fc;
}

/* ===== SUB-GROUPS ===== */
.nav-sub-group {
    margin-left: 0;
    overflow: hidden;
}

.nav-item-sub {
    padding-left: 24px !important;
    height: 32px;
    margin: 0 10px 0 20px !important;
}

.nav-item-sub .nav-icon-wrapper {
    width: 22px;
    height: 22px;
    margin-right: 8px;
}

.nav-item-sub .nav-icon-wrapper i {
    font-size: 11px;
}

.nav-item-sub span {
    font-size: 12px !important;
}

.nav-item-sub.active {
    padding-left: 24px !important;
}

/* Sub-group hidden by default, shown when expanded */
#movie-hunt-collection-sub,
#movie-hunt-activity-sub,
#media-hunt-config-sub,
#index-master-sub,
#index-master-view-sub {
    display: none;
    margin-top: 0;
}

#movie-hunt-collection-sub.expanded,
#movie-hunt-activity-sub.expanded,
#media-hunt-config-sub.expanded,
#index-master-sub.expanded,
#index-master-view-sub.expanded {
    display: block;
}

#movie-hunt-collection-sub .nav-item-sub,
#movie-hunt-activity-sub .nav-item-sub,
#media-hunt-config-sub .nav-item-sub,
#index-master-sub .nav-item-sub,
#index-master-view-sub .nav-item-sub {
    margin-top: 0;
    margin-bottom: 0;
}

/* When config sub-group is expanded, hide main Media Hunt items + other toggles */
#sidebar-group-media-hunt.config-view > #movieHuntCollectionNav,
#sidebar-group-media-hunt.config-view > #movie-hunt-collection-sub,
#sidebar-group-media-hunt.config-view > #movieHuntIndexMasterNav,
#sidebar-group-media-hunt.config-view > #movieHuntActivityToggle,
#sidebar-group-media-hunt.config-view > #movie-hunt-activity-sub,
#sidebar-group-media-hunt.config-view > #movieHuntClientsMainNav,
#sidebar-group-media-hunt.config-view > #movieHuntSettingsToggle {
    display: none !important;
}

/* When activity sub-group is expanded, hide main Media Hunt items + other toggles */
#sidebar-group-media-hunt.activity-view > #movieHuntCollectionNav,
#sidebar-group-media-hunt.activity-view > #movie-hunt-collection-sub,
#sidebar-group-media-hunt.activity-view > #movieHuntIndexMasterNav,
#sidebar-group-media-hunt.activity-view > #movieHuntActivityToggle,
#sidebar-group-media-hunt.activity-view > #movieHuntClientsMainNav,
#sidebar-group-media-hunt.activity-view > #movieHuntSettingsToggle,
#sidebar-group-media-hunt.activity-view > #media-hunt-config-sub {
    display: none !important;
}

/* Back button styling in config sub-group */
.media-hunt-config-back {
    opacity: 0.7;
    font-size: 0.85em;
}
.media-hunt-config-back:hover {
    opacity: 1;
}

/* ===== APP ICONS ===== */
.app-icon-img {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    transition: all 0.2s ease;
    filter: brightness(0.85) saturate(0.9);
}

.nav-item:hover .app-icon-img,
.nav-item.active .app-icon-img {
    filter: brightness(1.1) saturate(1.1);
}

/* App-specific active/hover colors */
.sonarr-app:hover .sonarr-icon,
.sonarr-app.active .sonarr-icon {
    background: rgba(99, 102, 241, 0.15);
    border-radius: 7px;
}
.sonarr-app.active .app-icon-img { filter: brightness(1.2) drop-shadow(0 0 4px rgba(99, 102, 241, 0.5)); }

.radarr-app:hover .radarr-icon,
.radarr-app.active .radarr-icon {
    background: rgba(241, 196, 15, 0.15);
    border-radius: 7px;
}
.radarr-app.active .app-icon-img { filter: brightness(1.2) drop-shadow(0 0 4px rgba(241, 196, 15, 0.5)); }

.lidarr-app:hover .lidarr-icon,
.lidarr-app.active .lidarr-icon {
    background: rgba(46, 204, 113, 0.15);
    border-radius: 7px;
}
.lidarr-app.active .app-icon-img { filter: brightness(1.2) drop-shadow(0 0 4px rgba(46, 204, 113, 0.5)); }

.readarr-app:hover .readarr-icon,
.readarr-app.active .readarr-icon {
    background: rgba(231, 76, 60, 0.15);
    border-radius: 7px;
}
.readarr-app.active .app-icon-img { filter: brightness(1.2) drop-shadow(0 0 4px rgba(231, 76, 60, 0.5)); }

.whisparr-app:hover .whisparr-icon,
.whisparr-app.active .whisparr-icon {
    background: rgba(155, 89, 182, 0.15);
    border-radius: 7px;
}
.whisparr-app.active .app-icon-img { filter: brightness(1.2) drop-shadow(0 0 4px rgba(155, 89, 182, 0.5)); }

.eros-app:hover .eros-icon,
.eros-app.active .eros-icon {
    background: rgba(142, 68, 173, 0.15);
    border-radius: 7px;
}
.eros-app.active .app-icon-img { filter: brightness(1.2) drop-shadow(0 0 4px rgba(142, 68, 173, 0.5)); }

.prowlarr-app:hover .prowlarr-icon,
.prowlarr-app.active .prowlarr-icon {
    background: rgba(230, 126, 34, 0.15);
    border-radius: 7px;
}
.prowlarr-app.active .app-icon-img { filter: brightness(1.2) drop-shadow(0 0 4px rgba(230, 126, 34, 0.5)); }

.swaparr-app:hover .swaparr-icon,
.swaparr-app.active .swaparr-icon {
    background: rgba(0, 188, 212, 0.15);
    border-radius: 7px;
}
.swaparr-app:hover .swaparr-icon i,
.swaparr-app.active .swaparr-icon i {
    color: #00bcd4;
    filter: drop-shadow(0 0 4px rgba(0, 188, 212, 0.5));
}

/* ===== SIDEBAR SOCIAL LINKS (inside footer) ===== */
.sidebar-social-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0;
}

.sidebar-social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
}

.sidebar-social-btn:hover {
    transform: translateY(-1px) scale(1.08);
    text-decoration: none;
}

.sidebar-social-btn.discord-btn {
    color: #5865f2;
    background: rgba(88, 101, 242, 0.08);
}
.sidebar-social-btn.discord-btn:hover {
    color: #7289da;
    background: rgba(88, 101, 242, 0.2);
    border-color: rgba(88, 101, 242, 0.3);
    box-shadow: 0 2px 8px rgba(88, 101, 242, 0.2);
}

.sidebar-social-btn.reddit-btn {
    color: #ff4500;
    background: rgba(255, 69, 0, 0.08);
}
.sidebar-social-btn.reddit-btn:hover {
    color: #ff6633;
    background: rgba(255, 69, 0, 0.2);
    border-color: rgba(255, 69, 0, 0.3);
    box-shadow: 0 2px 8px rgba(255, 69, 0, 0.2);
}

.sidebar-social-btn.docs-btn {
    color: #6366f1;
    background: rgba(99, 102, 241, 0.08);
}
.sidebar-social-btn.docs-btn:hover {
    color: #818cf8;
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.sidebar-social-btn.issues-btn {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
}
.sidebar-social-btn.issues-btn:hover {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

/* ===== SIDEBAR FOOTER ===== */
.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(12, 17, 28, 0.98) 0%, rgba(14, 19, 30, 0.99) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 10px 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 1002;
}

.sidebar-footer-divider {
    width: 80%;
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-footer-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    color: #475569;
    flex-wrap: wrap;
}

.sidebar-footer-version-link {
    text-decoration: none;
    transition: color 0.2s ease;
}

.sidebar-footer-version-link:hover {
    text-decoration: none;
}

.sidebar-footer-version-link:hover .sidebar-footer-version {
    color: #94a3b8;
}

.sidebar-footer-version {
    color: #64748b;
    font-variant-numeric: tabular-nums;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 10px;
    letter-spacing: 0.02em;
    transition: color 0.2s ease;
    vertical-align: middle;
}

.sidebar-footer-upgrade {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 9px;
    font-weight: 600;
    color: #34d399;
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.2);
    border-radius: 10px;
    padding: 2px 7px 2px 5px;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.2s ease;
    vertical-align: middle;
    position: relative;
    top: 1.5px;
}

.sidebar-footer-upgrade:hover {
    background: rgba(52, 211, 153, 0.16);
    border-color: rgba(52, 211, 153, 0.35);
    color: #6ee7b7;
    text-decoration: none;
}

.sidebar-footer-upgrade i {
    font-size: 7px;
    color: #34d399;
    transition: color 0.2s ease;
}

.sidebar-footer-upgrade:hover i {
    color: #6ee7b7;
}

.sidebar-footer-sep {
    color: #334155;
    font-size: 10px;
}

.sidebar-footer-dev {
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s ease;
}

.sidebar-footer-dev:hover {
    color: #94a3b8;
    text-decoration: none;
}

/* Adjust nav-menu bottom padding for sidebar footer */
.nav-menu {
    padding-bottom: 90px;
}

/* ===== SETTINGS SUBPANEL ===== */
.settings-subpanel {
    padding: 24px;
    max-width: 900px;
}

.settings-subpanel-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.settings-subpanel-description {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* ===== THEME SWITCH ===== */
.theme-switcher {
    padding: 24px;
    margin-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.switch-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 17px;
}

.light-icon, .dark-icon {
    color: var(--sidebar-text);
}

.switch {
    position: relative;
    display: inline-block;
    width: 100%;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--switch-bg);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--switch-active);
}

input:checked + .slider:before {
    transform: translateX(calc(100% + 4px));
}

.slider.round {
    border-radius: 34px;
    width: 48px;
}

.slider.round:before {
    border-radius: 50%;
}

/* ===== MOBILE: sidebar hidden — see mobile.css ===== */
