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

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

#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Auth 容器 (登入 & OTP) */
.auth-container {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    position: relative;
}

/* 語言切換器 */
.locale-switcher {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 12px;
    cursor: pointer;
}

.locale-switcher:focus {
    outline: none;
    border-color: #4a90d9;
}

.locale-switcher-header {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 12px;
    cursor: pointer;
}

.locale-switcher-header:focus {
    outline: none;
    border-color: #4a90d9;
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: bold;
    font-size: 14px;
}

.form-group input {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #4a90d9;
}

/* 按鈕 */
.btn-primary {
    padding: 12px;
    background-color: #4a90d9;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #357abd;
}

.btn-primary:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.btn-link {
    background: none;
    border: none;
    color: #4a90d9;
    font-size: 14px;
    cursor: pointer;
    margin-top: 10px;
    display: block;
    width: 100%;
    text-align: center;
}

.btn-link:hover {
    text-decoration: underline;
}

.btn-logout {
    padding: 8px 16px;
    background-color: transparent;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    background-color: #e74c3c;
    color: #fff;
    border-color: #e74c3c;
}

/* 訊息 */
.auth-message {
    text-align: center;
    font-size: 14px;
    min-height: 20px;
}

.auth-message.error {
    color: #e74c3c;
}

.auth-message.success {
    color: #27ae60;
}

/* OTP 樣式 */
.otp-hint {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
}

.otp-hint span {
    font-weight: bold;
    color: #333;
}

.otp-inputs {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.otp-input {
    width: 45px;
    height: 55px;
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: border-color 0.2s, background-color 0.2s;
}

.otp-input:focus {
    outline: none;
    border-color: #4a90d9;
}

.otp-input.filled {
    border-color: #4a90d9;
    background-color: #f0f7ff;
}

.otp-input.error {
    border-color: #e74c3c;
    background-color: #fff5f5;
}

/* 主頁面 */
.main-container {
    width: 100%;
    max-width: 1200px;
}

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

.main-header h1 {
    font-size: 24px;
    color: #333;
}

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

.user-info span {
    color: #666;
    font-size: 14px;
}

.main-content {
    padding: 40px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-content p {
    color: #666;
    font-size: 18px;
}

/* Dashboard */
.dashboard {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.dashboard-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.dashboard-card h2 {
    font-size: 18px;
    color: #333;
    margin-bottom: 15px;
}

.today-trip-card {
    text-align: center;
}

.today-trip-info .trip-name {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.today-trip-info .trip-stops {
    color: #666;
    margin-bottom: 15px;
}

.no-trip {
    color: #999;
    padding: 20px 0;
}

.dashboard-actions {
    display: flex;
    gap: 15px;
}

.action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    border-color: #4a90d9;
    background: #f0f7ff;
}

.action-icon {
    font-size: 32px;
}

/* 通用頁面容器 */
.page-container {
    width: 100%;
    max-width: 800px;
}

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

.page-header h1 {
    font-size: 20px;
    color: #333;
    flex: 1;
    text-align: center;
}

.page-content {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

/* 按鈕樣式 */
.btn-back {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-back:hover {
    background: #f5f5f5;
}

.btn-secondary {
    padding: 10px 20px;
    background: #fff;
    border: 1px solid #4a90d9;
    border-radius: 4px;
    color: #4a90d9;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-delete {
    padding: 8px 12px;
    background: transparent;
    border: 1px solid #e74c3c;
    border-radius: 4px;
    color: #e74c3c;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete:hover {
    background: #e74c3c;
    color: #fff;
}

.btn-edit {
    padding: 8px 12px;
    background: transparent;
    border: 1px solid #4a90d9;
    border-radius: 4px;
    color: #4a90d9;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-edit:hover {
    background: #4a90d9;
    color: #fff;
}

.btn-danger {
    padding: 10px 20px;
    background: #e74c3c;
    border: none;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-remove {
    width: 30px;
    height: 30px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    color: #999;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-remove:hover {
    background: #e74c3c;
    color: #fff;
}

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

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

/* 空狀態 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

/* 地點列表 */
.place-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.place-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.place-item:hover {
    background: #f0f7ff;
}

.place-info {
    flex: 1;
}

.place-info h3 {
    font-size: 16px;
    color: #333;
    margin-bottom: 5px;
}

.place-info p {
    font-size: 14px;
    color: #666;
}

/* 編輯表單 */
.edit-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.edit-form textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    resize: vertical;
}

.edit-form textarea:focus {
    outline: none;
    border-color: #4a90d9;
}

.input-with-button {
    display: flex;
    gap: 10px;
}

.input-with-button input {
    flex: 1;
}

.hint {
    font-weight: normal;
    color: #999;
    font-size: 14px;
}

/* 行程列表 */
.trip-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.trip-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    transition: all 0.2s;
}

.trip-item:hover {
    background: #f0f7ff;
}

.trip-info {
    flex: 1;
    cursor: pointer;
}

.trip-info h3 {
    font-size: 16px;
    color: #333;
    margin-bottom: 5px;
}

.trip-date {
    font-size: 14px;
    color: #666;
    margin-bottom: 3px;
}

.trip-stops-count {
    font-size: 14px;
    color: #999;
}

.trip-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-top: 5px;
}

.trip-status.planned {
    background: #e3f2fd;
    color: #1976d2;
}

.trip-status.in_progress {
    background: #fff3e0;
    color: #f57c00;
}

.trip-status.completed {
    background: #e8f5e9;
    color: #388e3c;
}

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

/* 停靠站列表 (編輯頁) */
.empty-stops {
    text-align: center;
    padding: 30px;
    background: #f9f9f9;
    border-radius: 8px;
    color: #999;
}

.stops-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.stop-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 8px;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.stop-item:active {
    cursor: grabbing;
}

.drag-handle {
    font-size: 18px;
    color: #999;
}

.stop-order {
    font-weight: bold;
    color: #666;
    min-width: 25px;
}

.stop-info {
    flex: 1;
}

.stop-name {
    display: block;
    font-weight: 500;
    color: #333;
}

.stop-address {
    display: block;
    font-size: 14px;
    color: #666;
}

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

/* Modal */
.modal-overlay {
    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: 1000;
}

.modal-content {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.modal-header h2 {
    font-size: 18px;
    color: #333;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

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

.place-selector-item {
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.place-selector-item:hover {
    background: #f0f7ff;
}

.place-selector-item h4 {
    font-size: 16px;
    color: #333;
    margin-bottom: 5px;
}

.place-selector-item p {
    font-size: 14px;
    color: #666;
}

/* 行程執行頁 */
.progress-section {
    margin-bottom: 20px;
}

.progress-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #4a90d9;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.execute-stops-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.execute-stop-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid #ddd;
}

.execute-stop-item.completed {
    background: #f0f9f0;
    border-left-color: #27ae60;
}

.stop-status-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 50%;
    font-weight: bold;
    color: #666;
}

.execute-stop-item.completed .stop-status-icon {
    background: #27ae60;
    border-color: #27ae60;
    color: #fff;
}

.stop-content {
    flex: 1;
}

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

.stop-header h3 {
    font-size: 16px;
    color: #333;
}

.btn-navigate {
    padding: 6px 12px;
    background: #4a90d9;
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-navigate:hover {
    background: #357abd;
}

.stop-completed-info {
    font-size: 14px;
    color: #27ae60;
    margin-top: 10px;
}

.stop-note {
    font-style: italic;
    color: #666;
    margin-top: 5px;
}

.stop-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-complete {
    padding: 8px 16px;
    background: #27ae60;
    border: none;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-complete:hover {
    background: #219a52;
}

.btn-note {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid #666;
    border-radius: 4px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-note:hover {
    background: #f5f5f5;
}

.note-editor {
    margin-top: 10px;
}

.note-editor textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    resize: vertical;
    margin-bottom: 10px;
}

.note-editor textarea:focus {
    outline: none;
    border-color: #4a90d9;
}

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

.note-actions .btn-primary,
.note-actions .btn-secondary {
    padding: 8px 16px;
    font-size: 14px;
}

.execute-bottom-actions {
    display: flex;
    justify-content: space-between;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* 行程編輯頁地圖 */
.trip-edit-container {
    max-width: 1200px;
}

.trip-edit-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
}

.trip-map-section {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.trip-map {
    width: 100%;
    height: 500px;
    background: #e5e5e5;
}

.trip-form-section {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

/* 響應式 */
@media (max-width: 480px) {
    .auth-container {
        padding: 20px;
        margin: 10px;
    }

    .otp-input {
        width: 40px;
        height: 50px;
        font-size: 20px;
    }

    .main-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .page-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .page-header h1 {
        order: -1;
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }

    .dashboard-actions {
        flex-direction: column;
    }

    .trip-item {
        flex-direction: column;
        align-items: stretch;
    }

    .trip-actions {
        margin-top: 10px;
        justify-content: flex-end;
    }

    .stop-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .execute-bottom-actions {
        flex-direction: column;
        gap: 10px;
    }

    .execute-bottom-actions button {
        width: 100%;
    }

    .trip-edit-layout {
        grid-template-columns: 1fr;
    }

    .trip-map {
        height: 300px;
    }
}
