/**
 * Trip Planner - Common Styles
 * 共用樣式：reset、基本元素、按鈕、表單、Modal、Toast
 */

/* ========================================
   Reset & Base
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    min-height: 100vh;
}

/* ========================================
   Layout
   ======================================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: #3498db;
    color: white;
}
.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #27ae60;
    color: white;
}
.btn-success:hover {
    background: #219a52;
}

.btn-warning {
    background: #f39c12;
    color: white;
}
.btn-warning:hover {
    background: #d68910;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}
.btn-danger:hover {
    background: #c0392b;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}
.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-ai {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.btn-ai:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.toolbar-separator {
    display: inline-block;
    width: 1px;
    height: 24px;
    background: #ddd;
    margin: 0 10px;
    vertical-align: middle;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
}

/* ========================================
   Forms
   ======================================== */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #34495e;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.help-text {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-top: 5px;
}

/* ========================================
   Status Badges
   ======================================== */
.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-confirmed {
    background: #d4edda;
    color: #155724;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-priority {
    background: #cce5ff;
    color: #004085;
}

/* Legacy status classes (for trip_map.html) */
.status.confirmed {
    background: #e8f5e9;
    color: #2e7d32;
}

.status.pending {
    background: #fff3e0;
    color: #ef6c00;
}

.status.priority {
    background: #fce4ec;
    color: #c2185b;
}

/* ========================================
   Cards
   ======================================== */
.card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

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

.card-title {
    font-weight: 600;
    color: #2c3e50;
}

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

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 700px;
    max-height: 80vh;
    width: 90%;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    background: linear-gradient(135deg, #1a5f7a 0%, #2d8659 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2,
.modal-header h3 {
    margin: 0;
    font-size: 1.3em;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.8em;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

.modal-close:hover {
    opacity: 0.8;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-body h3 {
    color: #1a5f7a;
    margin: 0 0 15px 0;
    font-size: 1.1em;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 8px;
}

.modal-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 0.9em;
}

.modal-body th,
.modal-body td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.modal-body th {
    background: #f5f5f5;
    font-weight: 600;
    color: #333;
}

.modal-body ul {
    margin: 10px 0;
    padding-left: 20px;
}

.modal-body li {
    margin: 5px 0;
    font-size: 0.9em;
}

/* ========================================
   Tips & Highlights
   ======================================== */
.tips {
    background: #fff8e1;
    border-left: 4px solid #ffc107;
    padding: 12px 15px;
    margin: 15px 0;
    border-radius: 0 8px 8px 0;
    font-size: 0.9em;
}

.tips strong {
    color: #e65100;
}

.highlight {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 12px 15px;
    margin: 15px 0;
    border-radius: 0 8px 8px 0;
    font-size: 0.9em;
}

/* ========================================
   Toast Notifications
   ======================================== */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    background: #27ae60;
    color: white;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.error {
    background: #e74c3c;
}

/* ========================================
   Loading State
   ======================================== */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: #666;
}

/* ========================================
   Footer
   ======================================== */
footer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 0.85em;
    margin-top: 30px;
}

/* ========================================
   Day Type Colors
   ======================================== */
.day-type-travel {
    background: #e8f4fd;
    color: #1976d2;
}

.day-type-transit {
    background: #fff3e0;
    color: #f57c00;
}

.day-type-itinerary {
    background: #e8f5e9;
    color: #388e3c;
}

.day-type-rest {
    background: #fce4ec;
    color: #c2185b;
}

/* ========================================
   Version Badge
   ======================================== */
.version-badge {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    font-size: 0.85rem;
}

/* ========================================
   Offline Indicator
   ======================================== */
.offline-indicator {
    position: fixed;
    bottom: 70px;
    right: 20px;
    background: #ff5722;
    color: white;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
