/**
 * Frontend Itinerary Editor Styles
 */

.gti-frontend-editor {
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #333;
}

/* Error Message */
.gti-error {
    padding: 20px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 8px;
    color: #c00;
    text-align: center;
}

/* Header */
.gti-header {
    margin-bottom: 30px;
    text-align: center;
}

.gti-main-title {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
}

/* Sections */
.gti-transfer-section,
.gti-days-section {
    margin-bottom: 30px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 12px;
}

.gti-transfer-section h3,
.gti-days-section h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

/* Transfer Options */
.gti-transfer-options {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.gti-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 16px;
}

.gti-checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Days Container */
.gti-days-container {
    margin-bottom: 20px;
}

/* Day Card */
.gti-day-card {
    margin-bottom: 20px;
    padding: 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s;
}

.gti-day-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.gti-day-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.gti-day-number {
    font-size: 18px;
    font-weight: 700;
    color: #2563eb;
}

.gti-day-badges {
    flex: 1;
}

.gti-toggle-day-actions {
    margin-left: auto;
}

.gti-badge {
    display: inline-block;
    padding: 4px 12px;
    margin-right: 8px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 20px;
}

.gti-badge-arrival {
    background: #dcfce7;
    color: #16a34a;
}

.gti-badge-departure {
    background: #fef3c7;
    color: #d97706;
}

.gti-day-actions {
    display: none;
    gap: 8px;
}

.gti-day-card.gti-show-actions .gti-day-actions {
    display: flex;
}

.gti-day-card.gti-show-actions .gti-toggle-day-actions {
    display: none;
}

/* Display Mode - Default view for day content */
.gti-display-mode {
    display: block;
}

.gti-day-card.gti-editing .gti-display-mode {
    display: none;
}

.gti-display-field {
    margin-bottom: 12px;
}

.gti-display-field:last-child {
    margin-bottom: 0;
}

.gti-display-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 4px;
}

.gti-display-value {
    display: block;
    font-size: 15px;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.gti-display-value:empty::after {
    content: "(未設定)";
    color: #999;
    font-style: italic;
}

/* Route title - larger h3 style */
.gti-display-field-route {
    margin-bottom: 16px;
}

h3.gti-display-route {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.4;
}

h3.gti-display-route:empty::after {
    content: "(未設定行程路線)";
    color: #999;
    font-style: italic;
    font-size: 1rem;
    font-weight: 400;
}

.gti-display-field-row {
    display: flex;
    gap: 20px;
}

.gti-display-field-half {
    flex: 1;
}

/* Edit Mode - Hidden by default */
.gti-edit-mode {
    display: none;
}

.gti-day-card.gti-editing .gti-edit-mode {
    display: block;
}

/* Edit/Save button visibility */
.gti-edit-day {
    display: inline-flex;
}

.gti-save-day {
    display: none;
}

.gti-day-card.gti-editing .gti-edit-day {
    display: none;
}

.gti-day-card.gti-editing .gti-save-day {
    display: inline-flex;
    background: #dcfce7;
    color: #16a34a;
}

.gti-day-card.gti-editing .gti-save-day:hover:not(:disabled) {
    background: #bbf7d0;
}

/* Editing state styling */
.gti-day-card.gti-editing {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Fields */
.gti-field {
    margin-bottom: 15px;
}

.gti-field:last-child {
    margin-bottom: 0;
}

.gti-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

.gti-field-row {
    display: flex;
    gap: 15px;
}

.gti-field-half {
    flex: 1;
}

.gti-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.gti-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

.gti-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.gti-textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

/* Buttons */
.gti-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.gti-btn-primary {
    background: #2563eb;
    color: #fff;
}

.gti-btn-primary:hover:not(:disabled) {
    background: #1d4ed8;
}

.gti-btn-primary.gti-copy-success {
    background: #22c55e;
}

.gti-btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.gti-btn-secondary:hover:not(:disabled) {
    background: #d1d5db;
}

.gti-btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    background: #f3f4f6;
    color: #374151;
    font-size: 16px;
}

.gti-btn-icon:hover:not(:disabled) {
    background: #e5e7eb;
}

.gti-btn-danger {
    color: #dc2626;
}

.gti-btn-danger:hover:not(:disabled) {
    background: #fee2e2;
    color: #dc2626;
}

.gti-btn-large {
    padding: 14px 28px;
    font-size: 17px;
}

.gti-btn-text {
    background: transparent;
    color: #6b7280;
    padding: 8px 16px;
}

.gti-btn-text:hover {
    color: #374151;
    background: #f3f4f6;
}

/* Actions */
.gti-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.gti-btn-mobile-line {
    display: none;
    background: #06C755;
    color: #fff;
}

.gti-btn-mobile-line:hover:not(:disabled) {
    background: #05b24c;
}

.gti-reset {
    text-align: center;
}

/* Responsive */
@media (max-width: 600px) {
    .gti-frontend-editor {
        padding: 15px;
    }

    .gti-transfer-options {
        flex-direction: column;
        gap: 15px;
    }

    .gti-field-row {
        flex-direction: column;
    }

    .gti-display-field-row {
        flex-direction: column;
        gap: 12px;
    }

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

    #gti-export-word {
        display: none;
    }

    .gti-btn-mobile-line {
        display: inline-flex;
        width: 100%;
        justify-content: center;
    }

    .gti-day-header {
        flex-wrap: wrap;
    }

    .gti-day-actions {
        width: 100%;
        justify-content: flex-end;
    }
}
