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

:root {
    --bg-color: #f5f5f5;
    --text-color: #333;
    --card-bg: #fff;
    --border-color: #ddd;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
}

/* Screens */
.screen {
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* Login Screen */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    background: var(--card-bg);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.login-container h1 {
    margin-bottom: 2rem;
    font-size: 2rem;
}

.login-container input {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.login-container input:focus {
    outline: none;
    border-color: #4CAF50;
}

.login-container button {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.login-container button:hover {
    background: #43a047;
}

/* Header */
header {
    background: var(--card-bg);
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.5rem;
}

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

#session-display {
    color: #666;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    background: #eee;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.btn-small:hover {
    background: #ddd;
}

.btn-notification {
    font-size: 1.1rem;
    padding: 0.4rem 0.6rem;
    opacity: 0.5;
    transition: opacity 0.2s, background 0.2s;
}

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

.btn-notification.enabled {
    opacity: 1;
    background: #e8f5e9;
}

.btn-notification.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

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

/* Projects Grid */
#projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Project Card */
.project-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    position: relative;
    border-left: 6px solid;
    transition: transform 0.2s;
}

.project-card:hover {
    transform: translateY(-2px);
}

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

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

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

.project-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.6;
    padding: 0.25rem;
}

.project-actions button:hover {
    opacity: 1;
}

.timer-display {
    font-size: 2.5rem;
    font-weight: 300;
    font-family: 'SF Mono', 'Monaco', monospace;
    text-align: center;
    margin: 1.5rem 0;
}

.timer-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.timer-btn.start {
    background: #4CAF50;
    color: white;
}

.timer-btn.start:hover {
    background: #43a047;
}

.timer-btn.stop {
    background: #f44336;
    color: white;
}

.timer-btn.stop:hover {
    background: #e53935;
}

.project-total {
    text-align: center;
    margin-top: 1rem;
    color: #666;
    font-size: 0.9rem;
}

/* Add Project Button */
.add-btn {
    display: block;
    width: 100%;
    max-width: 280px;
    margin: 0 auto 2rem;
    padding: 1.5rem;
    font-size: 1.1rem;
    background: var(--card-bg);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}

.add-btn:hover {
    border-color: #4CAF50;
    color: #4CAF50;
}

/* Time Overview */
#time-overview {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-top: 2rem;
}

#time-overview h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.overview-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid #eee;
}

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

.overview-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
}

#overview-total {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border-color);
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    justify-content: space-between;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

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

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

.modal-content input[type="text"] {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.modal-content input:focus {
    outline: none;
    border-color: #4CAF50;
}

/* Color Picker */
.color-picker {
    margin-bottom: 1.5rem;
}

.color-picker label {
    display: block;
    margin-bottom: 0.5rem;
    color: #666;
}

#color-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.2s;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: var(--text-color);
}

/* Time Inputs */
.time-inputs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.time-inputs label {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: #666;
    font-size: 0.9rem;
}

.time-inputs input {
    padding: 1rem;
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    background: var(--card-bg);
}

.time-inputs input:focus {
    outline: none;
    border-color: #4CAF50;
}

.time-inputs input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    padding: 0.25rem;
    opacity: 0.7;
}

.time-inputs input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.time-row {
    display: flex;
    gap: 1rem;
}

.time-row label {
    flex: 1;
}

#time-modal-project {
    margin-bottom: 1rem;
    font-weight: 500;
}

/* Modal Buttons */
.modal-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-primary {
    flex: 1;
    padding: 0.75rem;
    font-size: 1rem;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.btn-primary:hover {
    background: #43a047;
}

.btn-secondary {
    flex: 1;
    padding: 0.75rem;
    font-size: 1rem;
    background: #eee;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #ddd;
}

.btn-danger {
    padding: 0.75rem;
    font-size: 1rem;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.btn-danger:hover {
    background: #e53935;
}

/* History Section */
#history-section {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-top: 2rem;
}

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

.history-header h2 {
    font-size: 1.25rem;
    margin: 0;
}

#history-filter {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    cursor: pointer;
}

#history-filter:focus {
    outline: none;
    border-color: #4CAF50;
}

#history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
    margin: 0 -0.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    border-radius: 8px;
}

.history-item:hover {
    background: #f5f5f5;
}

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

.history-color {
    width: 8px;
    min-height: 40px;
    border-radius: 4px;
    flex-shrink: 0;
}

.history-content {
    flex: 1;
    min-width: 0;
}

.history-project {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.history-task {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.history-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: #888;
}

.history-date {
    white-space: nowrap;
}

.history-duration {
    font-weight: 500;
    color: var(--text-color);
}

.history-empty {
    color: #666;
    text-align: center;
    padding: 2rem;
}

#stop-modal-info {
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f5f5f5;
    border-radius: 8px;
    text-align: center;
}

/* Auth Toggle */
.auth-toggle {
    margin-top: 1.5rem;
    color: #666;
    font-size: 0.9rem;
}

.btn-link {
    background: none;
    border: none;
    color: #4CAF50;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    text-decoration: underline;
}

.btn-link:hover {
    color: #43a047;
}

.auth-error {
    background: #ffebee;
    color: #c62828;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.login-container #login-btn {
    margin-top: 0.5rem;
}

/* Responsive */
@media (max-width: 600px) {
    header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    main {
        padding: 1rem;
    }

    .project-card {
        padding: 1rem;
    }

    .timer-display {
        font-size: 2rem;
    }
}
