/* Modern Web App - Innovative & Attractive Design */

/* Import modern fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Manrope:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Modern Color Palette */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-warning: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    --gradient-dark: linear-gradient(135deg, #0c0c0c 0%, #1a1a2e 100%);
    --gradient-card-light: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    --gradient-card-dark: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    
    /* Light Mode Colors */
    --bg-primary-light: #f8fafc;
    --bg-secondary-light: #ffffff;
    --text-primary-light: #0f172a;
    --text-secondary-light: #64748b;
    --accent-light: #3b82f6;
    --success-light: #10b981;
    --warning-light: #f59e0b;
    --error-light: #ef4444;
    --border-light: rgba(148, 163, 184, 0.2);
    --shadow-light: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg-light: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Dark Mode Colors */
    --bg-primary-dark: #0f172a;
    --bg-secondary-dark: #1e293b;
    --text-primary-dark: #f1f5f9;
    --text-secondary-dark: #94a3b8;
    --accent-dark: #60a5fa;
    --success-dark: #34d399;
    --warning-dark: #fbbf24;
    --error-dark: #f87171;
    --border-dark: rgba(71, 85, 105, 0.3);
    --shadow-dark: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-lg-dark: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);

    /* Current theme variables */
    --bg-primary: var(--bg-primary-light);
    --bg-secondary: var(--bg-secondary-light);
    --text-primary: var(--text-primary-light);
    --text-secondary: var(--text-secondary-light);
    --accent: var(--accent-light);
    --success: var(--success-light);
    --warning: var(--warning-light);
    --error: var(--error-light);
    --border: var(--border-light);
    --shadow: var(--shadow-light);
    --shadow-lg: var(--shadow-lg-light);
    --gradient-card: var(--gradient-card-light);

    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Layout */
    --max-width: 1200px;
    --spacing: 1rem;
    --radius: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    
    /* Animation */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Dark theme */
[data-theme="dark"] {
    --bg-primary: var(--bg-primary-dark);
    --bg-secondary: var(--bg-secondary-dark);
    --text-primary: var(--text-primary-dark);
    --text-secondary: var(--text-secondary-dark);
    --accent: var(--accent-dark);
    --success: var(--success-dark);
    --warning: var(--warning-dark);
    --error: var(--error-dark);
    --border: var(--border-dark);
    --shadow: var(--shadow-dark);
    --shadow-lg: var(--shadow-lg-dark);
    --gradient-card: var(--gradient-card-dark);
}

/* Global Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

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

/* Main App Container */
.app-container {
    min-height: 100vh;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem;
    position: relative;
}

/* Header - Minimalist & Modern */
.app-header {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}

.app-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    position: relative;
}

.app-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
}

/* Theme Toggle - Floating Modern Button */
.theme-toggle {
    position: fixed;
    top: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
}

/* Screen Sections - Modern Cards */
.screen-section {
    background: var(--gradient-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.screen-section:hover {
    transform: translateY(-4px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

.hidden {
    display: none !important;
}

/* Welcome Screen - Hero Section */
.home-screen {
    text-align: center;
    padding: 4rem 2rem;
    position: relative;
}

.welcome-card {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

.welcome-card h2 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-card p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.app-description {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 2rem;
    margin: 2rem 0;
    border: 1px solid var(--border);
    text-align: left;
}

.app-description strong {
    color: var(--accent);
    font-weight: 600;
}

/* Action Buttons - Modern Design */
.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    min-width: 160px;
    justify-content: center;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-lg);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--border);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* Join Screen */
.join-screen {
    padding: 3rem;
    text-align: center;
}

.join-card {
    max-width: 500px;
    margin: 0 auto;
}

.join-card h2 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    background: var(--gradient-secondary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Input Groups - Modern Style */
.input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.input-group input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 1rem;
    transition: var(--transition);
    min-width: 200px;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

.input-group input::placeholder {
    color: var(--text-secondary);
}

/* Todo Screen - Revolutionary Design */
.todo-screen {
    min-height: 80vh;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem;
}

/* Header Section */
.todo-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    flex-wrap: wrap;
}

.list-info h2 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.list-code {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--gradient-success);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: var(--shadow);
}

.share-section {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    min-width: auto;
}

.btn-share {
    background: var(--gradient-success);
    color: white;
}

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

/* Progress Section - Innovative Design */
.progress-section {
    background: var(--gradient-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.progress-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.progress-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.progress-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.progress-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--bg-primary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    min-width: 80px;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: var(--gradient-success);
    border-radius: 6px;
    transition: width 0.8s var(--bounce);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: progressShine 2s infinite;
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Add Todo Section - Floating Design */
.add-todo-section {
    position: relative;
    margin-bottom: 2rem;
}

.add-todo-container {
    background: var(--gradient-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.add-todo-container:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

.add-todo-input {
    width: 100%;
    padding: 1rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 1.1rem;
    outline: none;
    resize: none;
    min-height: 60px;
}

.add-todo-input::placeholder {
    color: var(--text-secondary);
}

.add-todo-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.add-todo-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Todo List - Modern Grid Layout */
.todos-container {
    background: var(--gradient-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.todo-list-header {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.todo-list-header h3 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.todo-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.todo-item {
    display: flex;
    align-items: flex-start;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    background: var(--bg-secondary);
}

.todo-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--gradient-primary);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.todo-item:hover::before {
    transform: scaleY(1);
}

.todo-item:hover {
    background: var(--bg-primary);
    transform: translateX(8px);
}

.todo-item:last-child {
    border-bottom: none;
}

.todo-item.completed {
    opacity: 0.6;
    background: var(--bg-primary);
}

.todo-item.completed::before {
    background: var(--gradient-success);
    transform: scaleY(1);
}

.todo-item.completed .todo-text {
    text-decoration: line-through;
    color: var(--text-secondary);
}

/* Modern Checkbox */
.todo-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-radius: 8px;
    margin-right: 1rem;
    background: var(--bg-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
    margin-top: 2px;
}

.todo-checkbox:hover {
    border-color: var(--accent);
    background: var(--bg-primary);
    transform: scale(1.1);
}

.todo-checkbox.checked {
    background: var(--gradient-success);
    border-color: transparent;
    color: white;
}

.todo-checkbox.checked::after {
    content: '✓';
    font-size: 14px;
    font-weight: 700;
    animation: checkPop 0.3s var(--bounce);
}

@keyframes checkPop {
    0% { transform: scale(0) rotate(45deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.todo-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.todo-text {
    font-size: 1.1rem;
    color: var(--text-primary);
    line-height: 1.5;
    word-wrap: break-word;
}

.todo-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.todo-time {
    font-family: 'Monaco', 'Menlo', monospace;
}

/* Floating Action Button - Innovative */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 64px;
    height: 64px;
    background: var(--gradient-primary);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    font-weight: 300;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab:hover {
    transform: translateY(-4px) scale(1.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.fab:active {
    transform: translateY(-2px) scale(1.05);
}

/* Animations */
.todo-item.adding {
    animation: slideInUp 0.5s var(--bounce);
}

@keyframes slideInUp {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.todo-item.completing {
    animation: completeBounce 0.6s ease;
}

@keyframes completeBounce {
    0%, 100% { transform: translateX(0) scale(1); }
    25% { transform: translateX(8px) scale(1.02); }
    75% { transform: translateX(4px) scale(0.98); }
}

/* Empty State - Attractive */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state::before {
    content: '✨';
    display: block;
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

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

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 1rem;
    max-width: 400px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Modals - Sleek Design */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--gradient-card);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 500px;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--border);
    animation: scaleIn 0.3s var(--bounce);
}

@keyframes scaleIn {
    0% { transform: scale(0.8) translateY(20px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

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

.modal-header h3 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.modal-close:hover {
    background: var(--error);
    color: white;
    transform: scale(1.1);
}

.modal-body {
    padding: 2rem;
}

/* Toast Notifications - Modern */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
}

.toast {
    background: var(--gradient-card);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideInRight 0.4s var(--bounce);
}

@keyframes slideInRight {
    0% { transform: translateX(100%); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--error); }
.toast.info { border-left: 4px solid var(--accent); }

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    font-size: 1.2rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.toast-close:hover {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }
    
    .app-title {
        font-size: 2.5rem;
    }
    
    .theme-toggle {
        top: 1rem;
        right: 1rem;
        width: 44px;
        height: 44px;
    }
    
    .todo-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
    }
    
    .progress-stats {
        justify-content: center;
    }
    
    .fab {
        bottom: 1rem;
        right: 1rem;
        width: 56px;
        height: 56px;
    }
    
    .toast-container {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 0.5rem;
    }
    
    .screen-section {
        border-radius: var(--radius);
    }
    
    .todo-item {
        padding: 1rem;
    }
    
    .add-todo-container {
        padding: 1rem;
    }
}

/* Performance Optimizations */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles */
@media print {
    .theme-toggle,
    .fab,
    .modal-overlay,
    .toast-container {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --border-light: rgba(0, 0, 0, 0.3);
        --border-dark: rgba(255, 255, 255, 0.3);
    }
}