:root {
    --primary: #818cf8;
    --primary-hover: #6366f1;
    --bg-dark: #020617;
    --card-bg: rgba(15, 23, 42, 0.6);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6);
}

body.light-mode {
    --bg-dark: #f1f5f9;
    --card-bg: rgba(255, 255, 255, 0.7);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: rgba(0, 0, 0, 0.05);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

/* Utility Classes */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    transition: background-color 0.3s ease;
}

/* Background Galaxy Styles */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(ellipse at bottom, #1B2735 0%, #090A0F 100%);
    overflow: hidden;
}

.stars-container {
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    animation: rotateGalaxy 200s linear infinite;
}

.stars-container.slow {
    animation-duration: 400s;
    opacity: 0.6;
}

@keyframes rotateGalaxy {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    opacity: 0.5;
    animation: twinkle var(--duration) infinite ease-in-out;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

.nebula {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    animation: float 20s infinite alternate ease-in-out;
}

.nebula-1 {
    width: 500px;
    height: 500px;
    background: #4f46e5;
    top: -100px;
    left: -100px;
}

.nebula-2 {
    width: 600px;
    height: 600px;
    background: #9333ea;
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

.nebula-3 {
    width: 400px;
    height: 400px;
    background: #0ea5e9;
    top: 40%;
    left: 50%;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1) rotate(0deg); }
    50% { transform: translate(50px, 50px) scale(1.1) rotate(5deg); }
    100% { transform: translate(-20px, 30px) scale(1) rotate(-5deg); }
}

.container {
    width: 90%;
    max-width: 500px;
    background: var(--card-bg);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--glass-shadow);
    animation: fadeIn 0.6s ease-out;
}

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

.auth-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    position: relative;
    z-index: 10;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--card-bg);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: var(--glass-shadow);
    animation: fadeIn 0.6s ease-out;
}

.auth-form h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.auth-form p {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

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

.form-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.9rem 1.2rem;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
}

.form-group input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
}

.full-width {
    width: 100%;
    margin-top: 0.5rem;
}

.toggle-text {
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.toggle-text a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.hidden {
    display: none !important;
}

.history-section {
    margin-top: 1.5rem;
    display: flex;
    justify-content: space-between;
}

.logout-btn:hover {
    color: #ef4444;
}

header {
    margin-bottom: 2rem;
}

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

h1 {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -1px;
}

.theme-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.theme-btn:hover {
    background: var(--border);
    transform: translateY(-2px);
}

.todo-input-group {
    display: flex;
    gap: 0.8rem;
}

#todoInput {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

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

.add-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    width: 48px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.add-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.text-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.text-btn:hover {
    color: #ef4444;
}

.todo-list {
    list-style: none;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

.todo-list::-webkit-scrollbar {
    width: 5px;
}

.todo-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 0.8rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.todo-item:hover {
    transform: scale(1.02);
    background: rgba(255, 255, 255, 0.05);
}

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

.todo-item.completed span {
    text-decoration: line-through;
}

.checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

.todo-item.completed .checkbox {
    background: var(--primary);
}

.todo-item.completed .checkbox::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: white;
    font-size: 0.7rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.todo-text {
    flex: 1;
    font-size: 1rem;
    word-break: break-all;
    display: flex;
    flex-direction: column;
}

.task-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.history-modal {
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

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

.history-list {
    overflow-y: auto;
    padding-right: 10px;
}

.history-item {
    padding: 0.8rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

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

.history-action {
    font-weight: 600;
    text-transform: capitalize;
}

.action-created { color: var(--primary); }
.action-completed { color: #10b981; }
.action-deleted { color: #ef4444; }
.action-updated { color: #f59e0b; }

.history-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.item-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-btn:hover { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.delete-btn:hover { background: rgba(239, 68, 68, 0.1); color: #ef4444; }

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    padding: 2rem;
    border-radius: 24px;
    width: 90%;
    max-width: 400px;
}

.modal-content h2 {
    margin-bottom: 1.5rem;
}

.modal-content input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    outline: none;
}

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

.primary-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
}

.secondary-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
}
