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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* 登录页面样式 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #667eea;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* 主页面样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: white;
    padding: 20px 30px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    color: #667eea;
    margin: 0;
    flex: 1;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

#usernameDisplay {
    font-weight: 500;
    color: #666;
}

.create-timer-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.create-timer-section h2 {
    margin-bottom: 20px;
    color: #333;
}

#createTimerForm {
    display: flex;
    gap: 10px;
}

#createTimerForm input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 16px;
}

#createTimerForm input:focus {
    outline: none;
    border-color: #667eea;
}

.timers-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.timers-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.timers-section-header h2 {
    margin: 0;
    color: #333;
}

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

.timer-card {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.timer-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.timer-card.running {
    border-color: #667eea;
    background: #f0f4ff;
}

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

.timer-name {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.2s;
    display: inline-block;
    min-width: 100px;
}

.timer-name:hover {
    background-color: #f0f0f0;
}

.timer-name-edit {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    padding: 5px 10px;
    border: 2px solid #667eea;
    border-radius: 5px;
    background: white;
    min-width: 100px;
    font-family: inherit;
}

.timer-name-edit:focus {
    outline: none;
    border-color: #5568d3;
}

.timer-edit {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
    margin-right: 5px;
}

.timer-edit:hover {
    background: #138496;
}

.timer-delete {
    background: #ff4757;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.timer-delete:hover {
    background: #ff3838;
}

.timer-display {
    font-size: 36px;
    font-weight: bold;
    text-align: center;
    margin: 20px 0;
    color: #667eea;
    font-family: 'Courier New', monospace;
}

.timer-controls {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
    justify-content: space-between;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

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

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

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

.timer-set-time {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap;
}

.timer-set-time input {
    flex: 1;
    min-width: 0;
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 14px;
}

.timer-set-time input:focus {
    outline: none;
    border-color: #667eea;
}

.empty-message {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 18px;
}

.error-message {
    color: #dc3545;
    margin-top: 15px;
    text-align: center;
    display: none;
}

.error-message.show {
    display: block;
}

/* 确认对话框样式 */
.confirm-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.confirm-dialog {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    overflow: hidden;
}

.confirm-dialog-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.confirm-dialog-header h3 {
    margin: 0;
    color: #333;
    font-size: 20px;
}

.confirm-dialog-body {
    padding: 20px;
}

.confirm-dialog-body p {
    margin: 0;
    color: #666;
    font-size: 16px;
    line-height: 1.5;
}

.confirm-dialog-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .timers-grid {
        grid-template-columns: 1fr;
    }
    
    /* header 保持横向布局，但调整 padding 和字体大小以适应窄屏 */
    header {
        padding: 15px 20px;
        flex-wrap: nowrap;
    }
    
    header h1 {
        font-size: 1.2em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    #logoutBtn {
        flex-shrink: 0;
        padding: 8px 16px;
        font-size: 14px;
    }
    
    /* 保持按钮在同一行，但调整大小以适应窄屏 */
    .timer-controls {
        gap: 5px;
    }
    
    .timer-controls .btn {
        padding: 8px 12px;
        font-size: 12px;
        flex: 1;
        min-width: 0;
    }
    
    /* 保持输入框和按钮在同一行 */
    .timer-set-time {
        gap: 5px;
        flex-wrap: nowrap;
    }
    
    .timer-set-time input {
        flex: 1;
        min-width: 0;
        font-size: 12px;
        padding: 6px 8px;
    }
    
    .timer-set-time .btn {
        flex-shrink: 0;
        padding: 6px 12px;
        font-size: 12px;
    }
}

