/* Global CSS Variables & Dark Theme Setup */
:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.15);
    --secondary: #64748b;
    --secondary-hover: #475569;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-main: #0b0f19;
    --bg-sidebar: #111827;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-card-hover: rgba(30, 41, 59, 0.95);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --font-sans: 'Outfit', sans-serif;
    --radius-lg: 16px;
    --radius-md: 10px;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* App Layout Grid */
.app-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    height: 100vh;
    position: sticky;
    top: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.logo-icon {
    font-size: 2rem;
    color: var(--primary);
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.5));
}

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #ffffff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-text span {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: var(--transition);
}

.nav-item:hover {
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
    color: var(--text-main);
    background-color: var(--primary-light);
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.nav-item i {
    font-size: 1.1rem;
}

.sidebar-footer {
    margin-top: auto;
}

.quote-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(30, 41, 59, 0.5) 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.quote {
    font-style: italic;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    color: #e2e8f0;
}

.quote-author {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
}

/* Main Content Area */
.main-content {
    padding: 2rem 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow-y: auto;
}

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

.welcome-msg h2 {
    font-size: 1.75rem;
    font-weight: 600;
}

.welcome-msg p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background-color: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* Tabs */
.tab-content {
    display: none;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    animation: fadeIn 0.4s ease-out;
}

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

/* Stats Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-md);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stat-title {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-icon-wrapper {
    width: 36px;
    height: 36px;
    border-radius: 50px;
    background-color: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 700;
    margin: 1rem 0 0.5rem;
}

.stat-desc {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Accent highlight for cards */
.stat-card.streak {
    border-left: 4px solid var(--warning);
}
.stat-card.streak .stat-icon-wrapper {
    color: var(--warning);
    background-color: rgba(245, 158, 11, 0.1);
}

.stat-card.formula-card {
    border-left: 4px solid var(--success);
}
.stat-card.formula-card .stat-icon-wrapper {
    color: var(--success);
    background-color: rgba(16, 185, 129, 0.1);
}

/* Dashboard Details Layout */
.dashboard-details {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1.5rem;
}

.details-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    backdrop-filter: blur(10px);
}

.details-card h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.text-primary { color: var(--primary); }
.text-warning { color: var(--warning); }

/* Motivation Panel */
.motivation-panel p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.25rem;
}

.formula-display {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success);
    margin: 1.5rem 0;
}

.growth-goals {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.goal-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background-color: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.goal-days {
    font-weight: 500;
}

.goal-multiplier {
    color: var(--success);
    font-weight: 600;
}

/* Session Logs */
.session-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.session-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.session-item:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.session-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--border-color);
    padding-right: 1rem;
    min-width: 70px;
}

.session-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

.session-minutes {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: 0.25rem;
}

.session-right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
}

.session-notes {
    font-size: 0.9rem;
    color: var(--text-main);
}

.session-delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    align-self: center;
    padding: 0.5rem;
}

.session-delete-btn:hover {
    color: var(--danger);
    transform: scale(1.1);
}

.no-data {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
}

/* Literature Tab Grid */
.lit-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1.5rem;
    align-items: flex-start;
}

/* Form Styles */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 1rem;
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

input, select, textarea {
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Saved Studies Panel & List Filter */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.list-header h3 {
    margin-bottom: 0;
}

.search-filter-box {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.search-input-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.search-input-wrapper input {
    padding-left: 2.25rem;
    font-size: 0.85rem;
    width: 240px;
}

.search-filter-box select {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* Literature Grid Cards styling */
.lit-cards-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.lit-card {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: var(--transition);
}

.lit-card:hover {
    background-color: var(--bg-card-hover);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateX(4px);
}

.lit-badge {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 50px;
    text-transform: uppercase;
}

.badge-article {
    background-color: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-thesis {
    background-color: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-other {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.lit-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    padding-right: 6rem; /* Avoid overlap with badge */
    line-height: 1.4;
}

.lit-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.lit-meta span {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.lit-meta i {
    color: var(--primary);
}

.lit-links {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 0.75rem;
}

.link-btn {
    font-size: 0.75rem;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    transition: var(--transition);
}

.link-btn.drive {
    background-color: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.link-btn.drive:hover {
    background-color: rgba(16, 185, 129, 0.25);
}

.link-btn.notebook {
    background-color: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.link-btn.notebook:hover {
    background-color: rgba(99, 102, 241, 0.25);
}

.link-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
    cursor: default;
    background-color: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    border-color: transparent;
}

.lit-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.icon-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: var(--transition);
}

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

.icon-action-btn.edit:hover {
    color: var(--primary);
}

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

/* Modal Dialog Layer */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: #1e293b;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-md);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}

.modal-overlay.open .modal-content {
    transform: scale(1);
}

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

.modal-header h3 {
    margin-bottom: 0;
    font-size: 1.15rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.75rem;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
}

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

#logForm {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Responsiveness adjustments */
@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-details {
        grid-template-columns: 1fr;
    }
    .lit-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
    }
    .sidebar {
        height: auto;
        position: static;
        padding: 1.5rem;
    }
    .brand {
        margin-bottom: 1.5rem;
    }
    .nav-menu {
        flex-direction: row;
        overflow-x: auto;
    }
    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Authentication Screen CSS */
.login-screen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #0b0f19 0%, #1e1b4b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1.5rem;
    transition: var(--transition);
}

.login-screen-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.login-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(20px);
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
    filter: drop-shadow(0 0 12px rgba(99, 102, 241, 0.5));
}

.login-brand h2 {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #ffffff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-brand span {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-inner {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.input-icon-wrapper input {
    padding-left: 2.75rem;
    width: 100%;
}

.btn-block {
    width: 100%;
    justify-content: center;
    padding: 0.85rem;
}

.error-msg {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: -0.5rem;
    margin-bottom: 1rem;
    font-weight: 500;
    display: none;
}

.hidden {
    display: none !important;
}

.logout-btn {
    margin-top: 1rem;
    background-color: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.logout-btn:hover {
    background-color: rgba(239, 68, 68, 0.25);
    color: #ffffff;
    border-color: rgba(239, 68, 68, 0.4);
}

