/* 
 * Premium Dark Theme Styles 
 * Focuses on a modern, minimal aesthetic with sleek micro-animations and responsive layout.
 */

:root {
    /* Color Palette (Deep Indigo/Slate theme) */
    --bg-primary: #0f172a;       /* Slate 900 */
    --bg-secondary: #1e293b;     /* Slate 800 */
    --bg-tertiary: #334155;      /* Slate 700 */
    
    --accent-primary: #6366f1;   /* Indigo 500 */
    --accent-hover: #818cf8;     /* Indigo 400 */
    --accent-danger: #ef4444;    /* Red 500 */
    
    --text-primary: #f8fafc;     /* Slate 50 */
    --text-secondary: #94a3b8;   /* Slate 400 */
    --text-muted: #64748b;       /* Slate 500 */

    --border-color: rgba(255, 255, 255, 0.1);
    
    /* Layout */
    --sidebar-width: 300px;
    --border-radius: 12px;
    --transition-speed: 0.2s;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    /* Prevent pull-to-refresh on mobile if possible */
    overscroll-behavior-y: none; 
}

/* App Layout Container */
.app-container {
    display: flex;
    height: 100vh;
    height: 100dvh; /* Mobile friendly viewport height */
    overflow: hidden;
}

/* Typography & Common elements */
h1, h2, h3 {
    font-weight: 600;
}

ul {
    list-style: none;
}

input {
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    outline: none;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    outline: none;
    transition: transform var(--transition-speed), opacity var(--transition-speed);
}

button:active {
    transform: scale(0.95);
}

.primary-btn {
    background-color: var(--accent-primary);
    color: white;
    padding: 0.75rem;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-speed);
}

.primary-btn:hover {
    background-color: var(--accent-hover);
}

.icon-btn {
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.icon-btn.danger:hover {
    color: var(--accent-danger);
}

/* Forms */
#add-list-form, #add-item-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#add-list-form input, #add-item-form input {
    flex: 1;
    min-width: 0;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 20;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.add-list-container {
    padding: 0 1.5rem;
}

.lists-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.lists-container li {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color var(--transition-speed);
    color: var(--text-secondary);
}

.lists-container li:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.lists-container li.active {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--accent-primary);
    border-right: 3px solid var(--accent-primary);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    position: relative;
}

.main-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.header-spacer {
    width: 40px; /* To balance the mobile menu button for center alignment */
}

.main-header h2 {
    flex: 1;
    text-align: center;
    font-size: 1.25rem;
}

.items-section {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.items-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Item Styling (Glassmorphism & Micro-animations) */
.item-row {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: var(--border-radius);
    transition: transform var(--transition-speed), background var(--transition-speed);
}

.item-row:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
}

.item-row.completed .item-name {
    text-decoration: line-through;
    color: var(--text-muted);
}

.item-checkbox {
    appearance: none;
    width: 24px;
    height: 24px;
    border: 2px solid var(--text-muted);
    border-radius: 50%;
    margin-right: 1rem;
    cursor: pointer;
    position: relative;
    transition: border-color var(--transition-speed), background-color var(--transition-speed);
}

.item-checkbox:checked {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.item-checkbox:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    margin-top: -2px;
}

.item-name {
    flex: 1;
    font-size: 1rem;
    cursor: pointer;
    transition: color var(--transition-speed);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.sub-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Install Banner */
.install-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: var(--accent-primary);
    color: white;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transform: translateY(0);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.install-banner.hidden {
    display: flex !important; /* Override the default hidden behavior to allow transform animation */
    transform: translateY(-100%);
    pointer-events: none;
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.banner-icon {
    font-size: 1.25rem;
}

.banner-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.primary-btn.small {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
    background-color: white;
    color: var(--accent-primary);
    font-weight: 600;
}

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

.install-banner .icon-btn {
    color: rgba(255, 255, 255, 0.8);
}

.install-banner .icon-btn:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.15);
}

/* Mobile Responsiveness */
.mobile-only {
    display: none;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.overlay.show {
    display: block;
    opacity: 1;
}

@media (max-width: 768px) {
    .mobile-only {
        display: flex;
    }
    
    .sidebar {
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        transform: translateX(-100%);
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.5);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .header-spacer {
        display: none;
    }
    
    .main-header h2 {
        text-align: left;
        margin-left: 1rem;
    }
}
