/* Modern Lilac/Purple Color Palette - Lighter Version */
:root {
    --purple-dark: #2d1b4e;
    --purple-deep: #251442;
    --purple-main: #8b5cf6;
    --purple-light: #c4b5fd;
    --purple-soft: #ddd6fe;
    --lilac: #ede9fe;
    --accent-pink: #f5d0fe;
    --white: #ffffff;

    /* Extended palette for UI - Lighter tones */
    --bg-primary: #1e1433;
    --bg-secondary: #2a1f42;
    --bg-card: #362952;
    --bg-hover: #453662;
    --text-primary: #faf8ff;
    --text-secondary: #ddd6fe;
    --text-muted: #a89cc4;
    --border-color: rgba(196, 181, 253, 0.2);
    --success: #34d399;
    --success-soft: rgba(52, 211, 153, 0.15);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.15);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 30px rgba(139, 92, 246, 0.5);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Border radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Background gradient effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(139, 92, 246, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(245, 208, 254, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(196, 181, 253, 0.15) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

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

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 2.5rem;
    animation: fadeInDown 0.6s ease;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--purple-main), var(--purple-light));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
}

.logo-icon svg {
    width: 28px;
    height: 28px;
    color: var(--white);
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--white), var(--accent-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.author-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--accent-pink);
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

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

/* Main Content */
.main-content {
    flex: 1;
}

/* Input Section */
.input-section {
    margin-bottom: 1.5rem;
}

.todo-form {
    width: 100%;
}

.input-wrapper {
    display: flex;
    gap: 0.75rem;
    background: var(--bg-card);
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    transition: var(--transition-normal);
}

.input-wrapper:focus-within {
    border-color: var(--purple-light);
    box-shadow: var(--shadow-md), 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.todo-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
}

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

.add-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--purple-main), var(--purple-light));
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    font-family: inherit;
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.add-btn:active {
    transform: translateY(0);
}

.add-btn svg {
    width: 18px;
    height: 18px;
}

/* Filter Section */
.filter-section {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.375rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.filter-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-normal);
    font-family: inherit;
}

.filter-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.filter-btn.active {
    background: var(--purple-main);
    color: var(--white);
}

.filter-btn .count {
    background: rgba(255, 255, 255, 0.15);
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    min-width: 24px;
}

.filter-btn.active .count {
    background: rgba(255, 255, 255, 0.25);
}

/* Todo List */
.todo-list-container {
    position: relative;
    min-height: 200px;
}

.todo-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Todo Item */
.todo-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: var(--transition-normal);
    animation: fadeInUp 0.4s ease;
}

.todo-item:hover {
    background: var(--bg-hover);
    border-color: var(--purple-light);
    transform: translateX(4px);
}

.todo-item.completed {
    opacity: 0.7;
}

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

/* Custom Checkbox */
.checkbox-wrapper {
    position: relative;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.checkbox-wrapper input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    background: transparent;
    border: 2px solid var(--text-muted);
    border-radius: 50%;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkbox-wrapper input:hover ~ .checkmark {
    border-color: var(--purple-light);
}

.checkbox-wrapper input:checked ~ .checkmark {
    background: var(--success);
    border-color: var(--success);
}

.checkmark svg {
    width: 14px;
    height: 14px;
    color: var(--white);
    opacity: 0;
    transform: scale(0.5);
    transition: var(--transition-fast);
}

.checkbox-wrapper input:checked ~ .checkmark svg {
    opacity: 1;
    transform: scale(1);
}

/* Todo Text */
.todo-text {
    flex: 1;
    font-size: 1rem;
    color: var(--text-primary);
    word-break: break-word;
}

/* Action Buttons */
.todo-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: var(--transition-normal);
}

.todo-item:hover .todo-actions {
    opacity: 1;
}

.action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.action-btn svg {
    width: 18px;
    height: 18px;
}

.action-btn.edit-btn:hover {
    background: rgba(124, 58, 237, 0.2);
    color: var(--purple-light);
}

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

/* Empty State */
.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    padding: 2rem;
    display: none;
}

.empty-state.show {
    display: block;
    animation: fadeIn 0.4s ease;
}

.empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    background: var(--bg-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-icon svg {
    width: 40px;
    height: 40px;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.empty-state span {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(30, 20, 51, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
    z-index: 1000;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    width: 100%;
    max-width: 480px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    transform: scale(0.9) translateY(20px);
    transition: var(--transition-normal);
}

.modal.show .modal-content {
    transform: scale(1) translateY(0);
}

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

.modal-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.edit-form {
    padding: 1.5rem;
}

.edit-input {
    width: 100%;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    transition: var(--transition-normal);
    margin-bottom: 1.25rem;
}

.edit-input:focus {
    border-color: var(--purple-light);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.btn-cancel,
.btn-save {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    font-family: inherit;
    border: none;
}

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

.btn-cancel:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-save {
    background: linear-gradient(135deg, var(--purple-main), var(--purple-light));
    color: var(--white);
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

/* Footer */
.app-footer {
    text-align: center;
    padding-top: 2rem;
    margin-top: auto;
}

.app-footer p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

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

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

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Item exit animation */
.todo-item.removing {
    animation: fadeOutRight 0.3s ease forwards;
}

@keyframes fadeOutRight {
    to {
        opacity: 0;
        transform: translateX(50px);
    }
}

/* Responsive Design */
@media (max-width: 640px) {
    .app-container {
        padding: 1.5rem 1rem;
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    .logo-icon {
        width: 40px;
        height: 40px;
    }

    .input-wrapper {
        flex-direction: column;
        padding: 0.75rem;
    }

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

    .filter-section {
        flex-wrap: wrap;
    }

    .filter-btn {
        padding: 0.625rem 0.75rem;
        font-size: 0.8rem;
    }

    .todo-actions {
        opacity: 1;
    }

    .todo-item {
        padding: 0.875rem 1rem;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--purple-main);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--purple-light);
}

/* Selection */
::selection {
    background: var(--purple-light);
    color: var(--white);
}
