/* 全域樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft JhengHei', 'Arial', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* 登入頁面 */
.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

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

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 28px;
}

/* 頁籤 */
.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    transition: all 0.3s;
}

.tab-btn.active {
    color: #667eea;
    border-bottom: 2px solid #667eea;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: #667eea;
}

/* 表單 */
.form {
    display: none;
}

.form.active {
    display: block;
}

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

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

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

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

.form-info {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #666;
}

/* 按鈕 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

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

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

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

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

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

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

.btn-nav {
    background: #f8f9fa;
    color: #333;
    padding: 8px 16px;
    font-size: 14px;
}

.btn-nav:hover {
    background: #e9ecef;
}

.btn-today {
    background: #28a745;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
}

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

.btn-add {
    background: #667eea;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
}

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

.btn-logout {
    background: #dc3545;
    color: white;
    padding: 6px 12px;
    font-size: 14px;
}

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

.btn-admin {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 12px;
    font-size: 14px;
}

.btn-admin:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653e8f 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* 訊息 */
#message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    display: none;
}

#message.success {
    background: #d4edda;
    color: #155724;
    display: block;
}

#message.error {
    background: #f8d7da;
    color: #721c24;
    display: block;
}

/* 行事曆主頁面 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

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

.header h1 {
    color: #333;
}

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

.user-info span {
    color: #666;
}

/* Header 左側區域 */
.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* 語音輸入區域 */
.voice-input-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.language-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.language-select:hover {
    border-color: #667eea;
}

.language-select:focus {
    outline: none;
    border-color: #667eea;
}

.btn-voice {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s;
}

.btn-voice:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653e8f 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.voice-icon {
    font-size: 16px;
}

/* 語音 Modal 樣式 */
.voice-modal-content {
    max-width: 500px;
}

.voice-container {
    padding: 20px;
}

.voice-status {
    text-align: center;
    margin-bottom: 20px;
}

.voice-visualizer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    height: 60px;
    margin-bottom: 15px;
}

.voice-wave {
    width: 6px;
    height: 20px;
    background: #e0e0e0;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.voice-visualizer.recording .voice-wave {
    background: #667eea;
    animation: voiceWave 1s ease-in-out infinite;
}

.voice-visualizer.recording .voice-wave:nth-child(1) {
    animation-delay: 0s;
}

.voice-visualizer.recording .voice-wave:nth-child(2) {
    animation-delay: 0.1s;
}

.voice-visualizer.recording .voice-wave:nth-child(3) {
    animation-delay: 0.2s;
}

.voice-visualizer.recording .voice-wave:nth-child(4) {
    animation-delay: 0.3s;
}

.voice-visualizer.recording .voice-wave:nth-child(5) {
    animation-delay: 0.4s;
}

@keyframes voiceWave {
    0%, 100% {
        height: 20px;
    }
    50% {
        height: 50px;
    }
}

#voiceStatusText {
    font-size: 16px;
    color: #666;
    margin: 0;
    min-height: 24px;
}

#voiceStatusText.recording {
    color: #667eea;
    font-weight: bold;
}

#voiceStatusText.error {
    color: #dc3545;
}

#voiceStatusText.success {
    color: #28a745;
    font-weight: bold;
}

.voice-result {
    margin-bottom: 20px;
}

.voice-result label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: bold;
}

.voice-result textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
}

.voice-result textarea:focus {
    outline: none;
    border-color: #667eea;
}

.voice-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.voice-actions .btn {
    width: auto;
    min-width: 100px;
}

.voice-hint {
    text-align: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

.voice-hint p {
    margin: 0;
    color: #666;
    font-size: 13px;
}

/* 行事曆控制區 */
.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 15px 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.month-navigation {
    display: flex;
    align-items: center;
    gap: 20px;
}

.month-navigation h2 {
    color: #333;
    min-width: 150px;
    text-align: center;
}

/* 行事曆 */
.calendar-wrapper {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 20px;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #667eea;
    color: white;
}

.day-name {
    padding: 15px;
    text-align: center;
    font-weight: bold;
}

.calendar-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-day {
    min-height: 110px;
    border: 1px solid #eee;
    padding: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
}

.calendar-day:hover {
    background-color: #f8f9fa;
}

.calendar-day.other-month {
    background-color: #f5f5f5;
    color: #999;
}

.calendar-day.today {
    background-color: #e3f2fd;
}

.calendar-day.today .day-number {
    background: #667eea;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.day-number {
    font-weight: bold;
    margin-bottom: 2px;
}

.lunar-date {
    font-size: 11px;
    color: #999;
    margin-bottom: 3px;
}

.lunar-month {
    color: #e74c3c;
    font-weight: bold;
}

.day-events {
    font-size: 11px;
    margin-top: auto;
    overflow: hidden;
    flex: 1;
}

.event-dot {
    background: #667eea;
    color: white;
    padding: 1px 4px;
    border-radius: 3px;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 10px;
}

/* 事件列表 */
.events-section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px 30px;
}

.events-section h3 {
    margin-bottom: 15px;
    color: #333;
}

.events-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.event-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
    border-left: 4px solid #667eea;
}

.event-info h4 {
    color: #333;
    margin-bottom: 5px;
}

.event-meta {
    color: #666;
    font-size: 14px;
}

.event-actions {
    display: flex;
    gap: 10px;
}

.event-actions button {
    padding: 5px 10px;
    font-size: 14px;
}

.no-events {
    text-align: center;
    color: #999;
    padding: 30px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.close-btn:hover {
    color: #333;
}

.modal form {
    padding: 20px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.modal-buttons .btn {
    width: auto;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-left {
        flex-direction: column;
        gap: 10px;
    }
    
    .voice-input-section {
        flex-direction: column;
        gap: 8px;
    }
    
    .language-select {
        width: 100%;
        max-width: 200px;
    }
    
    .btn-voice {
        width: 100%;
        max-width: 200px;
        justify-content: center;
    }
    
    .voice-text {
        display: inline;
    }
    
    .calendar-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .calendar-day {
        min-height: 70px;
        padding: 4px;
    }
    
    .day-number {
        font-size: 12px;
        margin-bottom: 1px;
    }
    
    .lunar-date {
        font-size: 9px;
        margin-bottom: 2px;
    }
    
    .day-events {
        font-size: 9px;
    }
    
    .event-dot {
        font-size: 8px;
        padding: 1px 2px;
    }
    
    .event-item {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .voice-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .voice-actions .btn {
        width: 100%;
        max-width: 200px;
    }
}