/**
 * TourManager Component Styles
 */

/* Flash Messages */
.flash-message {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
    animation: flashSlide 0.3s ease;
}

@keyframes flashSlide {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.flash-message--success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.flash-message--error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

/* Base */
.tour-manager {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.tour-manager__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e8e8e8;
    flex-wrap: wrap;
    gap: 12px;
}

.tour-manager__title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0;
}

.tour-manager__title svg {
    color: #2196F3;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
}

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

/* Tours Grid */
.tours-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.tour-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e8e8e8;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.tour-card__image {
    position: relative;
    height: 160px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.tour-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tour-card__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: rgba(255,255,255,0.5);
}

.tour-card__badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge--active {
    background: #4CAF50;
    color: #fff;
}

.badge--inactive {
    background: rgba(255,255,255,0.9);
    color: #666;
}

.tour-card__body {
    padding: 16px;
}

.tour-card__title {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.tour-card__meta {
    display: flex;
    gap: 16px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: #666;
}

.meta-item svg {
    color: #999;
}

.tour-card__desc {
    margin: 0;
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
}

.tour-card__actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #eee;
    background: #fafafa;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-primary {
    background: #2196F3;
    color: #fff;
}

.btn-primary:hover {
    background: #1976D2;
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
}

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

.btn-outline {
    background: transparent;
    border: 2px solid #ddd;
    color: #555;
}

.btn-outline:hover {
    border-color: #2196F3;
    color: #2196F3;
}

.btn-danger-outline:hover {
    border-color: #f44336;
    color: #f44336;
}

.btn.is-loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn.is-loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    top: 50%;
    left: 50%;
    margin: -9px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state svg {
    opacity: 0.3;
    margin-bottom: 16px;
}

.empty-state p {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
    padding: 16px;
}

.pagination__link {
    color: #2196F3;
    text-decoration: none;
    font-weight: 500;
}

.pagination__link:hover {
    text-decoration: underline;
}

.pagination__info {
    color: #666;
    font-size: 0.9rem;
}

/* Form Layout */
.tour-form-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 24px;
    align-items: start;
}

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

.tour-form-sidebar {
    position: relative;
}

.form-section {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e8e8e8;
}

.form-section--sticky {
    position: sticky;
    top: 20px;
}

.form-section__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.form-section__title svg {
    color: #2196F3;
}

.story-count {
    margin-left: auto;
    font-weight: 400;
    color: #999;
    font-size: 0.85rem;
}

/* Form Controls */
.form-label {
    display: block;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.form-label .required {
    color: #f44336;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: #2196F3;
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.form-col--grow {
    flex: 1;
}

.form-col--auto {
    min-width: 150px;
}

.form-hint {
    font-size: 0.85rem;
    color: #666;
    margin: 8px 0 16px 0;
}

/* Switch */
.switch-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 0;
}

.switch-label input {
    width: 20px;
    height: 20px;
}

.switch-text {
    font-size: 0.9rem;
    color: #333;
}

/* Media Editor */
.media-editor {
    margin-top: 8px;
}

.media-preview {
    position: relative;
    display: inline-block;
}

.media-preview img {
    max-width: 300px;
    max-height: 180px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.media-preview .btn-delete {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f44336;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-controls {
    display: flex;
    gap: 12px;
}

/* Story Selector */
.story-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.story-selector select {
    flex: 1;
}

/* Selected Stories List */
.selected-stories {
    min-height: 100px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 12px;
}

.selected-stories:empty::before {
    content: 'No stories added yet. Select stories from the dropdown above.';
    display: block;
    text-align: center;
    color: #999;
    padding: 30px;
    font-size: 0.9rem;
}

.story-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: grab;
    transition: background 0.2s;
}

.story-item:hover {
    background: #e8f4fd;
}

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

.story-item.dragging {
    opacity: 0.5;
    background: #e3f2fd;
}

.story-item__order {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2196F3;
    color: #fff;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.story-item__info {
    flex: 1;
    min-width: 0;
}

.story-item__title {
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.story-item__point {
    font-size: 0.8rem;
    color: #666;
}

.story-item__remove {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    border-radius: 4px;
    flex-shrink: 0;
}

.story-item__remove:hover {
    background: #ffebee;
    color: #f44336;
}

/* Tour Map */
.tour-map {
    height: 300px;
    border-radius: 8px;
    border: 1px solid #ddd;
    margin-bottom: 12px;
}

.route-info {
    font-size: 0.85rem;
    color: #666;
    text-align: center;
}

.route-info p {
    margin: 0;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid #eee;
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 900px) {
    .tour-form-layout {
        grid-template-columns: 1fr;
    }

    .form-section--sticky {
        position: static;
    }

    .tour-map {
        height: 250px;
    }
}

@media (max-width: 600px) {
    .tour-manager {
        padding: 12px;
    }

    .tours-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-col--auto {
        min-width: 100%;
    }

    .story-selector {
        flex-direction: column;
    }

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

    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
}
