:root {
    --bg-color: #f8fafc;
    --text-color: #0f172a;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --modal-bg: rgba(0, 0, 0, 0.5);
    --modal-content-bg: #ffffff;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --input-border: #cbd5e1;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0f172a;
        --text-color: #f8fafc;
        --card-bg: #1e293b;
        --card-border: #334155;
        --modal-bg: rgba(0, 0, 0, 0.7);
        --modal-content-bg: #1e293b;
        --primary-color: #3b82f6;
        --primary-hover: #60a5fa;
        --input-border: #475569;
    }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    transition: background-color 0.3s, color 0.3s;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: 500;
}

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

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

.btn.full-width {
    width: 100%;
}

main {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

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

/* Timer Card Styles */
.timer-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

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

.timer-name {
    font-size: 1.25rem;
    font-weight: 600;
}

.delete-btn {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.delete-btn:hover {
    opacity: 1;
}

.timer-countdown {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin: 1rem 0;
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
}

.timer-target-date {
    font-size: 0.875rem;
    color: #64748b;
    text-align: center;
    margin-top: auto;
}

@media (prefers-color-scheme: dark) {
    .timer-target-date {
        color: #94a3b8;
    }
}

.timer-completed {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin: 1rem 0;
    color: #10b981;
}

.timer-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    display: none;
    opacity: 0;
}

.modal-content {
    background-color: var(--modal-content-bg);
    padding: 2rem;
    border-radius: 0.75rem;
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
    opacity: 0.7;
}

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

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

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--input-border);
    border-radius: 0.375rem;
    background-color: transparent;
    color: var(--text-color);
    font-size: 1rem;
}

.form-group input[type="color"] {
    padding: 0.2rem;
    height: 40px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
}
