:root {
    /* Color Palette */
    --bg-dark: #0f172a; /* Tailwind slate-900 */
    --bg-darker: #020617; /* Tailwind slate-950 */
    --surface: rgba(30, 41, 59, 0.7); /* slate-800 with opacity for glassmorphism */
    --surface-hover: rgba(51, 65, 85, 0.9);
    --border: rgba(148, 163, 184, 0.1);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-purple: #8b5cf6;
    --accent-pink: #ec4899;
    --success: #10b981;
    --danger: #ef4444;

    /* Typography */
    --font-main: 'Outfit', sans-serif;
    
    /* Layout */
    --sidebar-width: 260px;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-darker);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Glassmorphism utilities */
.glass {
    background: var(--surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-dark);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 3rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

.logo-text {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.logo-text span {
    color: var(--accent-blue);
    font-weight: 300;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 5px;
}

.nav-links::-webkit-scrollbar {
    width: 4px;
}
.nav-links::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.nav-links li {
    padding: 0.8rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.nav-links li:hover {
    background: var(--surface);
    color: var(--text-primary);
    transform: translateX(5px);
}

.nav-links li.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), transparent);
    color: var(--accent-blue);
    border-left: 3px solid var(--accent-blue);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.user-profile img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid var(--accent-purple);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 1rem;
}

.user-status {
    font-size: 0.8rem;
    color: var(--success);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem 3rem;
    position: relative;
    background: radial-gradient(circle at top right, rgba(139, 92, 246, 0.05), transparent 40%),
                radial-gradient(circle at bottom left, rgba(59, 130, 246, 0.05), transparent 40%);
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.header-title h2 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-title p {
    color: var(--text-secondary);
    margin-top: 0.3rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.btn-icon:hover {
    color: var(--text-primary);
    border-color: var(--accent-blue);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

/* Pages */
.page {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.page.active {
    display: block;
}

#quote.page.active, #ai.page.active, #characters.page.active {
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dashboard Grid */
.grid-layout {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.span-2 {
    grid-column: span 3;
}

/* Cards */
.card {
    padding: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.stat-icon.purple {
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-purple);
}

.stat-icon.blue {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
}

.stat-details h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.3rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Card Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

/* Buttons */
.btn-primary {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-family: var(--font-main);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--accent-blue-hover);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.btn-success {
    background: var(--success);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-family: var(--font-main);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-success:hover {
    opacity: 0.9;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.btn-gradient {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-family: var(--font-main);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.5);
}

/* Inputs */
.input-group, .note-editor {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.3s ease;
}

.note-editor {
    flex-direction: column;
}

input[type="text"], textarea {
    flex: 1;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-main);
    outline: none;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus, textarea:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.hidden {
    display: none !important;
}

/* Lists */
.list-container {
    list-style: none;
}

.list-item {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.list-item:hover {
    background: rgba(51, 65, 85, 0.5);
    border-color: rgba(148, 163, 184, 0.3);
}

.list-item.completed span {
    color: var(--text-secondary);
}

.item-actions button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    margin-left: 10px;
    transition: color 0.2s ease;
}

.item-actions button:hover {
    color: var(--danger);
}

.item-actions button.check-btn:hover {
    color: var(--success);
}

/* Grid Lists (Notes, Addictions) */
.grid-list, .notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.2rem;
}

.addiction-card, .note-card {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--border);
    padding: 1.2rem;
    border-radius: 12px;
    position: relative;
    transition: transform 0.2s ease;
}

.addiction-card:hover, .note-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-purple);
}

.streak-counter {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-purple);
    margin: 10px 0;
}

.note-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--accent-blue);
}

.note-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
}

/* AI Section */
.ai-main-card {
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.ai-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    gap: 2rem;
}

.ai-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 2px solid var(--accent-purple);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--accent-purple);
    margin: 0 auto 1.5rem auto;
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4); }
    70% { box-shadow: 0 0 0 20px rgba(139, 92, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); }
}

.ai-results {
    width: 100%;
    margin-top: 2rem;
    text-align: left;
    background: rgba(15, 23, 42, 0.6);
    padding: 2rem;
    border-radius: 12px;
    border-left: 4px solid var(--accent-purple);
}

.loading-spinner {
    color: var(--accent-purple);
    font-size: 1.2rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.ai-report h4 {
    color: var(--accent-pink);
    margin-bottom: 10px;
    margin-top: 15px;
}

.ai-report p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 10px;
}

.ai-report ul {
    margin-left: 20px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.ai-report li {
    margin-bottom: 5px;
}

.delete-btn {
    position: absolute;
    bottom: 1.2rem;
    right: 1.2rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

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

/* Margins */
.mt-4 {
    margin-top: 1.5rem;
}

/* Tabs */
.goals-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 1rem;
    overflow-x: auto;
    padding-bottom: 5px;
}

.tab-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-main);
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

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

.tab-btn.active {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

/* File Upload Area */
.file-upload-area {
    border: 2px dashed var(--accent-purple);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    background: rgba(139, 92, 246, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-upload-area:hover, .file-upload-area.dragover {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--accent-pink);
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.file-card {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.2s ease;
}

.file-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-blue);
}

.file-icon {
    font-size: 2rem;
    color: var(--text-secondary);
}

.file-icon.image { color: #ec4899; }
.file-icon.pdf { color: #ef4444; }
.file-icon.word { color: #3b82f6; }
.file-icon.excel { color: #10b981; }

.file-info {
    flex: 1;
    overflow: hidden;
}

.file-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.file-size {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.file-actions {
    display: flex;
    gap: 10px;
}

/* Admin Styles */
.admin-trigger {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(30, 41, 59, 0.8);
    color: var(--text-secondary);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    border: 1px solid var(--border);
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    z-index: 100;
}

.admin-trigger:hover {
    color: var(--text-primary);
    border-color: var(--accent-blue);
    background: var(--surface);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    background: var(--bg-darker);
    padding: 2rem;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    border: 1px solid var(--accent-purple);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
}

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

.modal-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border);
    padding: 10px 15px;
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-main);
    margin-bottom: 10px;
}

.modal-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

/* Folders Container */
.folder-section {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem;
    margin-bottom: 1.5rem;
}

.folder-section h4 {
    color: var(--accent-blue);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Admin Menu Items */
.admin-menu-item {
    display: flex;
    gap: 10px;
    align-items: center;
    background: rgba(30, 41, 59, 0.5);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.admin-menu-item input {
    flex: 1;
    margin-bottom: 0;
}

.admin-menu-item select {
    background: rgba(15, 23, 42, 0.8);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px 10px;
    font-size: 1.2rem;
    transition: color 0.2s;
}

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

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: var(--bg-darker);
    min-width: 180px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.5);
    z-index: 50;
    border-radius: 8px;
    border: 1px solid var(--accent-purple);
    overflow: hidden;
    animation: fadeIn 0.2s ease;
}

.dropdown.show .dropdown-content {
    display: block;
}

.dropdown-content button {
    color: var(--text-primary);
    padding: 12px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
    font-family: var(--font-main);
}

.dropdown-content button:last-child {
    border-bottom: none;
}

.dropdown-content button:hover {
    background-color: rgba(255,255,255,0.1);
}

.dropdown-content button.text-danger:hover {
    background-color: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.task-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
    margin-top: 4px;
}

.status-badge {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 12px;
    margin-left: 10px;
    font-weight: 600;
}
.status-badge.off { background: rgba(148, 163, 184, 0.2); color: var(--text-secondary); }
.status-badge.failed { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.status-badge.completed { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.status-badge.skipped { background: rgba(168, 85, 247, 0.2); color: #a855f7; }

/* Mobile Responsiveness */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    margin-right: 15px;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 5px 0 25px rgba(0,0,0,0.5);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 1.5rem 1rem;
    }
    
    .grid-layout {
        grid-template-columns: 1fr;
    }
    
    .span-2 {
        grid-column: span 1;
    }
    
    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .header-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .header-beta-note {
        display: none !important;
    }
    
    .file-upload-area {
        padding: 2rem 1rem;
    }
    
    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }
}
