/* CSS Custom Properties */
:root {
    --primary-color: #1a83cc; /* Blue Grotto */
    --primary-dark: #00478f; /* Midnight Blue */
    --success-color: #10b981;
    --success-dark: #059669;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --text-primary: #00478f; /* Midnight Blue for primary text */
    --text-secondary: #1a83cc; /* Blue Grotto for secondary text */
    --text-light: #65dff6; /* Tiffany Blue for light text */
    --background: #ffffff;
    --surface: #f8fafc;
    --surface-elevated: #ffffff;
    --border: #cbebf5; /* Baby Blue for borders */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--surface) 0%, var(--background) 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* App Container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0 1rem;
}

/* Header */
.app-header {
    padding: 2rem 0;
    text-align: center;
    margin-bottom: 2rem;
}

.header-content {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.back-link {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: var(--transition);
    background: var(--surface);
    border: 1px solid var(--border);
}

.back-link:hover {
    color: var(--text-primary);
    background: var(--surface-elevated);
    box-shadow: var(--shadow-md);
    transform: translateY(-50%) translateX(-2px);
}

.app-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Main Content */
.app-main {
    flex: 1;
    padding: 0 0 2rem 0;
}

.task-workspace {
    width: 100%;
    margin: 0 auto;
}

/* Workspace Layout */
.workspace-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: start;
}

/* Main Task Area - Left Column */
.main-task-area {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.main-task-area .task-section {
    padding: 2.5rem;
    margin-bottom: 0;
}

.main-task-area .section-header h2 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

.main-task-area .section-header p {
    font-size: 1.125rem;
}

/* Completed Tasks Sidebar - Right Column */
.completed-tasks-sidebar {
    position: sticky;
    top: 2rem;
}

.completed-tasks-sidebar .task-section {
    padding: 1.5rem;
    margin-bottom: 0;
}

.completed-tasks-sidebar .section-header h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.completed-tasks-sidebar .section-header p {
    font-size: 0.875rem;
}

/* Task Sections */
.task-section {
    background: var(--surface-elevated);
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.task-section:hover {
    box-shadow: var(--shadow-lg);
}

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

.section-header-content {
    text-align: center;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

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

.download-btn {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    white-space: nowrap;
    margin-top: 1.5rem;
    width: 100%;
    justify-content: center;
}

/* Task Form */
.task-form {
    width: 100%;
}

.input-group {
    display: flex;
    gap: 1rem;
    align-items: stretch;
}

#task-input {
    flex: 1;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--background);
    color: var(--text-primary);
    transition: var(--transition);
    font-family: inherit;
}

#task-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

#task-input::placeholder {
    color: var(--text-light);
}

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

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

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

.btn-secondary {
    background: var(--surface);
    color: var(--text-secondary);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface-elevated);
    color: var(--text-primary);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

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

/* Current Task Display */
.current-task-display {
    text-align: center;
    padding: 2rem 0;
}

.task-content {
    margin-bottom: 2rem;
}

.task-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.current-task-text {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2rem;
    line-height: 1.3;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.task-timer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
}

.timer-display {
    font-size: 2.5rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: var(--primary-color);
    letter-spacing: 2px;
}

.timer-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.task-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Completed Tasks */
.completed-tasks-container {
    min-height: 200px;
}

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

.completed-task-list li {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    animation: slideInUp 0.3s ease-out;
}

.completed-task-list li:hover {
    background: var(--surface-elevated);
    box-shadow: var(--shadow-sm);
}

.completed-task-list li span:first-child {
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    margin-right: 1rem;
}

.task-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

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

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.empty-state p {
    font-size: 1.125rem;
    margin: 0;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.app-footer p {
    font-size: 0.875rem;
}

.app-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.app-footer a:hover {
    text-decoration: underline;
}

/* Animations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.task-section {
    animation: fadeIn 0.5s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        padding: 0 0.75rem;
    }
    
    .workspace-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .main-task-area .task-section {
        padding: 1.5rem;
        margin-bottom: 0;
    }
    
    .main-task-area .section-header h2 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .main-task-area .section-header p {
        font-size: 1rem;
    }
    
    .completed-tasks-sidebar {
        position: static;
    }
    
    .completed-tasks-sidebar .task-section {
        padding: 1.5rem;
        margin-bottom: 0;
    }
    
    .completed-tasks-sidebar .section-header h2 {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }
    
    .completed-tasks-sidebar .section-header p {
        font-size: 0.875rem;
    }
    
    .task-section {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .input-group {
        flex-direction: column;
        gap: 1rem;
    }
    
    .btn {
        justify-content: center;
    }
    
    .task-actions {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .completed-task-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .completed-task-list li span:first-child {
        margin-right: 0;
    }
    
    .back-link {
        position: static;
        transform: none;
        align-self: flex-start;
        margin-bottom: 1rem;
    }
    
    .header-content {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 1.5rem 0;
    }
    
    .task-section {
        padding: 1.25rem;
    }
    
    .current-task-text {
        font-size: 1.5rem;
    }
    
    .timer-display {
        font-size: 2rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --surface: #1e293b;
        --surface-elevated: #334155;
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-light: #64748b;
        --border: #334155;
    }
}

/* Focus indicators for better accessibility */
.btn:focus,
#task-input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Loading states */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Improved button states */
.btn:active {
    transform: translateY(1px);
}

/* Success animation */
@keyframes successPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.btn-success:active {
    animation: successPulse 0.3s ease-out;
}

/* Screen Reader Only - Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: var(--radius-sm);
    z-index: 1000;
    transition: var(--transition);
}

.skip-link:focus {
    top: 6px;
}

/* Notification improvements */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 500;
    z-index: 1000;
    transform: translateX(100%);
    transition: var(--transition);
    max-width: 300px;
    box-shadow: var(--shadow-lg);
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: var(--success-color);
}

.notification.error {
    background: var(--error-color);
}

.notification.warning {
    background: var(--warning-color);
}

.notification.info {
    background: var(--primary-color);
}
