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

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #fafafa;
    --text-primary: #333;
    --text-secondary: #666;
    --text-muted: #999;
    --border-color: #e5e5e5;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --accent: #000;
    --success: #4caf50;
    --danger: #f44336;
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --text-primary: #e5e5e5;
    --text-secondary: #ccc;
    --text-muted: #999;
    --border-color: #404040;
    --shadow: 0 1px 3px rgba(255,255,255,0.1);
    --accent: #fff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: all 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

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

.logo h1 {
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.header-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.btn:hover {
    background: var(--bg-secondary);
}

.btn.primary {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}

.btn.danger {
    color: var(--danger);
    border-color: var(--danger);
}

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

.menu-container {
    position: relative;
}

.menu-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.menu-btn:hover {
    background: var(--bg-secondary);
}

.menu-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: var(--shadow);
    min-width: 160px;
    z-index: 10;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    pointer-events: none;
}

.menu-dropdown.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.menu-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    text-align: left;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.menu-item:hover {
    background: var(--bg-secondary);
}

.menu-item.danger {
    color: var(--danger);
}

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

.timer-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
}

.timer-card.running {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

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

.timer-title {
    font-size: 1.125rem;
    font-weight: 400;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 60%;
    cursor: pointer;
}

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

.timer-action {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.timer-action:hover {
    background: var(--bg-primary);
    color: var(--text-secondary);
}

.timer-display {
    font-size: 2.5rem;
    font-family: 'Courier New', monospace;
    font-weight: 300;
    margin-bottom: 1rem;
    letter-spacing: 1px;
    position: relative;
}

.timer-display.editable {
    cursor: pointer;
    border: 1px dashed transparent;
    padding: 0.25rem;
    border-radius: 4px;
}

.timer-display.editable:hover {
    border-color: var(--border-color);
}

.pay-toggle {
    display: flex;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.pay-btn {
    flex: 1;
    padding: 0.5rem;
    background: var(--bg-primary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.pay-btn.active {
    background: var(--accent);
    color: var(--bg-primary);
}

.rate-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

.rate-input:focus {
    outline: none;
    border-color: var(--accent);
}

.timer-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.timer-btn {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.timer-btn.primary {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}

.timer-btn:hover {
    opacity: 0.8;
}

.timer-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.timer-stats {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.stat-row {
    display: flex;
    justify-content: space-between;
}

.add-timer {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 3rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.add-timer:hover {
    border-color: var(--text-muted);
    color: var(--text-secondary);
}

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

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow);
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 500;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

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

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

.time-input {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.time-input input {
    width: 60px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    text-align: center;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: var(--shadow);
    z-index: 1001;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    min-width: 250px;
}

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

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

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

.shortcuts {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 1rem 0;
    text-align: center;
}

.footer {
    text-align: center;
    padding: 1rem 0;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

.footer a:hover {
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .header {
        flex-direction: row;
        gap: 1rem;
    }
    
    .timer-display {
        font-size: 2rem;
    }
    
    .timer-controls {
        flex-direction: column;
    }
    
    .timer-btn {
        flex: none;
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}
