/* ============================================
   DSA Tracker - Main Stylesheet
   Mobile-first responsive design with dark mode
   ============================================ */

/* CSS Variables for easy theming */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #64748b;
    --accent-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: all 0.3s ease;
}

/* Dark Mode Colors */
body.dark-mode {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
}

/* Navigation */
.navbar {
    background-color: var(--bg-primary);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0.5rem;
}

.nav-menu li a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-weight: 500;
}

.nav-menu li a:hover,
.nav-menu li a.active {
    background-color: var(--bg-tertiary);
    color: var(--primary-color);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
    z-index: 1001;
    position: relative;
}

.nav-toggle:hover {
    background-color: var(--bg-tertiary);
}

.nav-toggle:active {
    transform: scale(0.95);
}

/* ============ SIMPLE MOBILE MENU ============ */
@media (max-width: 768px) {
    /* Show hamburger button */
    .nav-toggle {
        display: block;
    }
    
    /* Hide menu by default - move it off screen */
    .nav-menu {
        position: fixed;
        left: -300px;
        top: 0;
        height: 100vh;
        width: 250px;
        background: white;
        flex-direction: column;
        padding: 80px 20px 20px;
        box-shadow: 2px 0 10px rgba(0,0,0,0.2);
        transition: left 0.3s ease;
        z-index: 999;
    }
    
    /* Show menu when active class is added */
    .nav-menu.active {
        left: 0;
    }
    
    /* Stack menu items vertically */
    .nav-menu li {
        margin: 10px 0;
    }
    
    .nav-menu li a {
        padding: 15px;
        display: block;
        border-radius: 5px;
    }
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

@media (max-width: 768px) {
    .container { padding: 1rem; }
}

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

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--secondary-color);
    color: white;
}

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

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

.btn-text {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: white;
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
}

.stat-content p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Charts */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background-color: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.chart-card h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

/* Recent & Upcoming Sections */
.recent-section,
.upcoming-section {
    margin-bottom: 2rem;
}

.recent-section .section-header,
.upcoming-section .section-header {
    margin-bottom: 1.5rem;
}

/* Problems & Revisions */
.problems-list,
.revisions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.problem-item,
.revision-item {
    background-color: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
}

.problem-item:hover,
.revision-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.problem-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.75rem;
}

.problem-title {
    font-size: 1.125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.problem-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-topic {
    background-color: var(--primary-color);
    color: white;
}

.badge-easy {
    background-color: #dcfce7;
    color: #166534;
}

.badge-medium {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-hard {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-overdue {
    background-color: #fecaca;
    color: #991b1b;
    animation: pulse 2s infinite;
}

.badge-today {
    background-color: #dbeafe;
    color: #1e40af;
    font-weight: 700;
}

body.dark-mode .badge-easy {
    background-color: #166534;
    color: #dcfce7;
}

body.dark-mode .badge-overdue {
    background-color: #991b1b;
    color: #fecaca;
}

body.dark-mode .badge-today {
    background-color: #1e40af;
    color: #dbeafe;
}

/* Forms */
.form-container {
    max-width: 800px;
    margin: 0 auto;
}

.form-header {
    text-align: center;
    margin-bottom: 2rem;
}

.problem-form {
    background-color: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background-color: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.modal-close,
.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.modal-close:hover,
.close-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(100px);
    transition: var(--transition);
    z-index: 3000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background-color: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Profile */
.profile-section {
    background-color: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    transition: 0.4s;
    border-radius: 30px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

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

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(30px);
}

/* Additional utilities */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

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

.welcome-section {
    margin-bottom: 2rem;
}

.welcome-section h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.welcome-section p {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

.filters-section {
    background-color: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
}

.search-bar {
    position: relative;
    margin-bottom: 1rem;
}

.search-bar i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

.search-bar input {
    padding-left: 2.5rem;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: end;
}

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

.info-box {
    background-color: #dbeafe;
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin: 1.5rem 0;
}

body.dark-mode .info-box {
    background-color: #1e3a5f;
}

.difficulty-slider {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.difficulty-slider input[type="range"] {
    flex: 1;
}

.difficulty-labels {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.settings-label {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.data-actions {
    display: grid;
    gap: 1.5rem;
}

.action-card {
    background-color: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    display: flex;
    gap: 1rem;
}

.danger-zone {
    border: 2px solid var(--danger-color);
}

.filter-chip {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    background-color: var(--bg-primary);
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.filter-chip.active {
    background-color: var(--primary-color);
    color: white;
}

.results-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--bg-primary);
    border-radius: var(--radius-md);
}

.modal-large {
    max-width: 900px;
}

.difficulty-btn {
    padding: 1rem;
    border: 2px solid var(--border-color);
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.difficulty-btn.selected {
    background-color: var(--primary-color);
    color: white;
}

.revision-difficulty-btns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.profile-avatar {
    font-size: 5rem;
    color: var(--primary-color);
}

.profile-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-item label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-item p {
    font-size: 1.125rem;
    color: var(--text-primary);
    font-weight: 500;
}

.action-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.action-content {
    flex: 1;
}

.action-content h3 {
    margin-bottom: 0.5rem;
    font-size: 1.125rem;
}

.action-content p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.danger-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.danger-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.danger-item strong {
    display: block;
    margin-bottom: 0.25rem;
}

.danger-item p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.profile-container {
    max-width: 900px;
    margin: 0 auto;
}

.revisions-filter {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.revision-date-group {
    margin-bottom: 2rem;
}

.revision-date-header {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

/* ============================================
   ENHANCED ANIMATIONS & EFFECTS
   ============================================ */

/* Pulse animation for important elements */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Slide in from bottom */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide out to bottom */
@keyframes slideOutDown {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(30px);
    }
}

/* Fade in */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Scale up on load */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Apply animations to cards */
.card, .stat-card, .chart-card, .problem-item, .revision-item {
    animation: slideInUp 0.5s ease-out;
}

/* Stagger animation for grid items */
.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

/* Enhanced button hover with ripple effect */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:active {
    transform: scale(0.97);
}

/* Gradient backgrounds for special cards */
.stat-card:nth-child(1) .stat-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-card:nth-child(2) .stat-icon {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-card:nth-child(3) .stat-icon {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-card:nth-child(4) .stat-icon {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

/* Smooth color transition for difficulty badges */
.difficulty-badge {
    transition: all 0.3s ease;
    position: relative;
}

.difficulty-badge::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.difficulty-badge:hover::after {
    opacity: 1;
}

/* Loading skeleton animation */
@keyframes skeleton {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 0px, var(--bg-tertiary) 40px, var(--bg-secondary) 80px);
    background-size: 200px 100%;
    animation: skeleton 1.2s ease-in-out infinite;
}

/* Enhanced navbar with shadow on scroll */
.navbar.scrolled {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Smooth transitions for all interactive elements */
a, button, input, textarea, select {
    transition: all 0.2s ease;
}

/* Focus states for accessibility */
a:focus, button:focus, input:focus, textarea:focus, select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Glass morphism effect for modals */
.modal-content {
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

body.dark-mode .modal-content {
    background: rgba(15, 23, 42, 0.95);
}

/* Floating animation for welcome section */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.welcome-section h1 {
    animation: float 3s ease-in-out infinite;
}

/* Icon rotation on hover */
.stat-icon {
    transition: transform 0.3s ease;
}

.stat-card:hover .stat-icon {
    transform: rotate(5deg) scale(1.1);
}

/* Button group hover effect */
.btn-group .btn:not(:last-child) {
    margin-right: -1px;
}

.btn-group .btn:hover {
    z-index: 1;
}

/* Enhanced toast notifications */
.toast {
    animation: slideInUp 0.3s ease-out;
}

.toast.success {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.toast.error {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* Card flip effect for problem cards */
.problem-item {
    transform-style: preserve-3d;
    perspective: 1000px;
}

/* Progress bar animation */
@keyframes progressBar {
    from { width: 0; }
}

.progress-bar {
    animation: progressBar 1s ease-out;
}

/* Shine effect on cards */
@keyframes shine {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.card-shine {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    background-size: 200% auto;
    animation: shine 3s linear infinite;
}

/* Mobile menu slide animation */
.nav-menu.active {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        left: -100%;
    }
    to {
        opacity: 1;
        left: 0;
    }
}

/* Enhanced form input focus */
input:focus, textarea:focus, select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Checkbox and radio custom styling */
input[type="checkbox"], input[type="radio"] {
    cursor: pointer;
    width: 20px;
    height: 20px;
}

/* Loading spinner enhancement */
.spinner {
    border: 4px solid rgba(79, 70, 229, 0.1);
    border-top-color: var(--primary-color);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive image hover */
img {
    transition: transform 0.3s ease;
}

img:hover {
    transform: scale(1.05);
}

/* Badge pulse animation */
.badge-pulse {
    animation: pulse 2s infinite;
}

/* Success checkmark animation */
@keyframes checkmark {
    0% {
        stroke-dashoffset: 100;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

/* Empty state illustration animation */
.empty-state {
    animation: fadeIn 0.5s ease-out;
}

/* Gradient text effect */
.gradient-text {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   DSA Chatbot Styles
   ============================================ */

/* Floating Chat Button */
.dsa-chatbot-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4);
    z-index: 9999;
    transition: all 0.3s ease;
    animation: float 3s ease-in-out infinite;
}

.dsa-chatbot-float:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 28px rgba(79, 70, 229, 0.5);
}

.dsa-chatbot-float.hidden {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.chatbot-badge {
    position: absolute;
    bottom: -8px;
    right: -8px;
    background: #10b981;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* Chat Window */
.dsa-chatbot-window {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 420px;
    height: 600px;
    background: var(--bg-primary);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    z-index: 10000;
    transform: scale(0) translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: hidden;
}

.dsa-chatbot-window.active {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Chat Header */
.chatbot-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

.chatbot-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
}

.chatbot-title i {
    font-size: 24px;
}

.chatbot-status {
    display: block;
    font-size: 12px;
    font-weight: 400;
    opacity: 0.9;
    margin-top: 2px;
}

.chatbot-status::before {
    content: '●';
    color: #10b981;
    margin-right: 4px;
    animation: pulse 2s infinite;
}

.chatbot-actions {
    display: flex;
    gap: 8px;
}

.chatbot-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chatbot-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Chat Messages */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.chatbot-message {
    display: flex;
    gap: 12px;
    animation: messageSlide 0.3s ease-out;
}

.chatbot-message.user {
    justify-content: flex-end;
}

.chatbot-message.user .message-content {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    border-radius: 18px 18px 4px 18px;
    max-width: 75%;
}

.message-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
}

.message-content {
    background: var(--bg-primary);
    padding: 12px 16px;
    border-radius: 18px 18px 18px 4px;
    font-size: 14px;
    line-height: 1.6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    max-width: 85%;
}

.message-content strong {
    display: block;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.message-content p {
    margin: 8px 0;
}

.message-content ul, .message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 4px 0;
}

.message-content code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
}

.message-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
    font-size: 13px;
    line-height: 1.6;
}

.message-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

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

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.quick-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.quick-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

/* Solution Container */
.solution-container {
    max-width: 100%;
}

.solution-container h3 {
    color: var(--primary-color);
    margin-bottom: 16px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.solution-container h4 {
    color: var(--text-primary);
    margin: 16px 0 8px 0;
    font-size: 15px;
}

.solution-section {
    margin-bottom: 20px;
}

.solution-tips {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(124, 58, 237, 0.1));
    border-left: 3px solid var(--primary-color);
    padding: 12px;
    border-radius: 8px;
    margin-top: 16px;
}

.quick-examples {
    margin-top: 16px;
}

.example-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    margin: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.example-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* Typing Indicator */
.typing-indicator .message-content {
    padding: 16px 20px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Chat Input */
.chatbot-input-container {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 16px;
}

.chatbot-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#chatbotInput {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    outline: none;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    transition: border-color 0.2s;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

#chatbotInput:focus {
    border-color: var(--primary-color);
}

.send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.send-btn:active {
    transform: scale(0.95);
}

.chatbot-footer {
    margin-top: 8px;
    text-align: center;
    color: var(--text-muted);
    font-size: 11px;
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE FIRST
   ============================================ */

/* Tablet and Below (768px) */
@media (max-width: 768px) {
    /* Chatbot */
    .dsa-chatbot-window {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .dsa-chatbot-float {
        bottom: 20px;
        right: 20px;
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
    
    .chatbot-badge {
        font-size: 9px;
        padding: 3px 6px;
    }

    /* Typography */
    .welcome-section h1 {
        font-size: 1.75rem;
    }

    .welcome-section p {
        font-size: 1rem;
    }

    h2 {
        font-size: 1.5rem;
    }

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

    .stat-card {
        padding: 1rem;
    }

    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .stat-content h3 {
        font-size: 1.5rem;
    }

    /* Charts */
    .charts-section {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Problems and Revisions */
    .problems-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .problem-item,
    .revision-item {
        padding: 1rem;
    }

    .problem-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .problem-meta {
        font-size: 0.8rem;
        gap: 0.75rem;
    }

    /* Filters */
    .filters-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .revisions-filter {
        justify-content: flex-start;
    }

    /* Forms */
    .form-container {
        padding: 0;
    }

    .problem-form {
        padding: 1rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    .form-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* Modal */
    .modal {
        padding: 0.5rem;
    }

    .modal-content {
        max-width: 100%;
        max-height: 95vh;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions button {
        width: 100%;
    }

    /* Toast */
    .toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: calc(100% - 2rem);
    }

    /* Profile */
    .profile-info {
        flex-direction: column;
        gap: 1rem;
    }

    .profile-avatar {
        font-size: 3rem;
    }

    /* Page Header */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .page-header .btn {
        width: 100%;
        justify-content: center;
    }

    /* Section Header */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    /* Feature Grid */
    .feature-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    /* Goal Modal */
    .goal-modal-content {
        margin: 1rem;
        padding: 1rem;
        max-width: 100%;
    }

    /* Data Actions */
    .action-card {
        flex-direction: column;
    }

    .danger-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .danger-item .btn {
        width: 100%;
    }

    /* Tabs */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        white-space: nowrap;
        padding: 0.75rem 1rem;
    }

    /* Difficulty Slider */
    .revision-difficulty-btns {
        grid-template-columns: 1fr;
    }

    /* Empty State */
    .empty-state {
        padding: 2rem 1rem;
    }

    .empty-state i {
        font-size: 3rem;
    }

    /* Results Summary */
    .results-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    /* Notification Prompt */
    #notificationPrompt {
        bottom: 10px !important;
        right: 10px !important;
        left: 10px !important;
        max-width: calc(100% - 20px) !important;
    }
}

/* Mobile Phones (480px and below) */
@media (max-width: 480px) {
    /* Navigation */
    .nav-container {
        padding: 0.75rem 1rem;
    }

    .nav-brand {
        font-size: 1.25rem;
    }

    /* Stats Grid - Single Column on Small Phones */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Welcome Section */
    .welcome-section h1 {
        font-size: 1.5rem;
    }

    .welcome-section p {
        font-size: 0.9rem;
    }

    /* Cards */
    .stat-card,
    .chart-card,
    .problem-item,
    .revision-item {
        padding: 0.875rem;
    }

    /* Badges */
    .badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
    }

    /* Buttons */
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.9rem;
    }

    /* Problem Meta */
    .problem-meta {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    /* Filter Chips */
    .filter-chip {
        font-size: 0.875rem;
        padding: 0.4rem 0.875rem;
    }

    /* Modal */
    .modal-header h2 {
        font-size: 1.25rem;
    }

    /* Chatbot Float Button */
    .dsa-chatbot-float {
        width: 55px;
        height: 55px;
        font-size: 22px;
        bottom: 15px;
        right: 15px;
    }

    /* Form Inputs */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Charts - Adjust Height for Mobile */
    .chart-card canvas {
        max-height: 250px;
    }

    /* Settings Items */
    .settings-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    /* Info Items */
    .info-item p {
        font-size: 1rem;
    }

    /* Action Cards */
    .action-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
}

/* Large Tablets (992px and below) */
@media (max-width: 992px) {
    .container {
        padding: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-section {
        grid-template-columns: 1fr;
    }

    .problems-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

/* Very Small Devices (360px and below) */
@media (max-width: 360px) {
    .nav-brand span {
        display: none;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-icon {
        width: 45px;
        height: 45px;
        font-size: 1.25rem;
    }

    .stat-content h3 {
        font-size: 1.25rem;
    }

    .stat-content p {
        font-size: 0.75rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
}

/* Landscape Mode for Phones */
@media (max-width: 768px) and (orientation: landscape) {
    .welcome-section {
        margin-bottom: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-icon {
        width: 45px;
        height: 45px;
        font-size: 1.25rem;
    }
}

/* Touch Device Improvements */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn,
    .nav-menu li a,
    .tab-btn,
    .filter-chip {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Remove hover effects on touch devices */
    .stat-card:hover,
    .problem-item:hover,
    .revision-item:hover {
        transform: none;
    }

    /* Better touch feedback */
    .btn:active {
        opacity: 0.8;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .nav-toggle,
    .dsa-chatbot-float,
    .dsa-chatbot-window,
    #loadingSpinner,
    #toast,
    .btn,
    .form-actions {
        display: none !important;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    .stat-card,
    .chart-card,
    .problem-item {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
