/* Cruise Price Tracker - Stylesheet */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

h1 {
    font-size: 28px;
    margin-bottom: 20px;
    color: #2c3e50;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-button {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
}

.tab-button:hover {
    color: #3498db;
    background: #f8f9fa;
}

.tab-button.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

#tab-chart {
    padding: 20px 0;
    min-height: 600px;
}

.chart-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.chart-controls label {
    font-weight: 500;
    color: #555;
}

.chart-controls select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
}

#price-chart {
    max-height: 600px;
}

#tab-trends {
    padding: 20px 0;
}

/* Controls Section */
.controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-weight: 500;
    color: #555;
}

.control-group select,
.control-group input[type="text"] {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.control-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

button {
    padding: 8px 16px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

button:hover {
    background: #2980b9;
}

button:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.status-info {
    margin-left: auto;
    font-size: 13px;
    color: #666;
}

/* Table Styles - Spreadsheet-like */
.table-container {
    overflow-x: auto;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead {
    background: #34495e;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

th:hover {
    background: #2c3e50;
}

th.sortable::after {
    content: ' ↕';
    opacity: 0.3;
}

th.sort-asc::after {
    content: ' ↑';
    opacity: 1;
}

th.sort-desc::after {
    content: ' ↓';
    opacity: 1;
}

tbody tr {
    border-bottom: 1px solid #e0e0e0;
}

tbody tr.cruise-row {
    cursor: pointer;
}

tbody tr:hover {
    background: #f8f9fa;
}

/* Region header row */
tbody tr.region-header {
    background: #e8f4f8;
    font-weight: 600;
    cursor: default;
}

tbody tr.region-header td {
    padding: 12px 8px;
    font-size: 15px;
    color: #2c3e50;
    border-top: 2px solid #3498db;
    border-bottom: 1px solid #3498db;
}

tbody tr.region-header:hover {
    background: #e8f4f8;
}

td {
    padding: 10px 8px;
    white-space: nowrap;
}

/* Column-specific styles */
td.cruise-line {
    font-weight: 600;
    color: #2980b9;
}

td.price {
    text-align: right;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    position: relative;
}

td.price:hover {
    background: #e8f4f8;
}

/* Sold out cruise rows */
tbody tr.cruise-row.sold-out {
    opacity: 0.5;
    background: #f5f5f5;
}

tbody tr.cruise-row.sold-out:hover {
    opacity: 0.6;
    background: #ececec;
}

/* Price change highlighting */
td.price.price-decreased {
    background: #d4edda;
    color: #155724;
    font-weight: 600;
}

td.price.price-increased {
    opacity: 0.5;
    color: #999;
}

td.price.price-decreased:hover {
    background: #c3e6cb;
}

td.price.price-increased:hover {
    opacity: 0.6;
    background: #f8f9fa;
}

/* Price Tooltip */
.price-tooltip {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 200px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

.price-tooltip h4 {
    margin-bottom: 8px;
    font-size: 14px;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    padding-bottom: 4px;
}

.price-tooltip .history-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
}

.price-tooltip .history-date {
    color: #666;
}

.price-tooltip .history-price {
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.price-tooltip .price-change {
    font-size: 11px;
    margin-left: 8px;
}

.price-up {
    color: #e74c3c;
}

.price-down {
    color: #27ae60;
}

.price-same {
    color: #95a5a6;
}

/* Loading/Error States */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.error {
    background: #fee;
    border: 1px solid #fcc;
    padding: 15px;
    border-radius: 4px;
    color: #c00;
    margin: 20px 0;
}

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

/* Itinerary Button and Display */
.itinerary-cell {
    text-align: center;
    padding: 4px !important;
}

.itinerary-btn {
    background: #ecf0f1;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.itinerary-btn:hover {
    background: #3498db;
    border-color: #2980b9;
}

.itinerary-row {
    background: #f8f9fa !important;
}

.itinerary-row:hover {
    background: #f8f9fa !important;
}

.itinerary-container {
    padding: 20px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 10px;
}

.itinerary-container h4 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 16px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

.itinerary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.itinerary-table thead {
    background: #ecf0f1;
    color: #2c3e50;
    position: static;
}

.itinerary-table th {
    padding: 10px;
    text-align: left;
    font-weight: 600;
    cursor: default;
    border-bottom: 2px solid #bdc3c7;
}

.itinerary-table th:hover {
    background: #ecf0f1;
}

.itinerary-table tbody tr {
    border-bottom: 1px solid #ecf0f1;
}

.itinerary-table tbody tr:hover {
    background: #f8f9fa;
}

.itinerary-table td {
    padding: 8px 10px;
    white-space: normal;
}

/* Responsive */
@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .control-group {
        flex-direction: column;
        align-items: stretch;
    }

    .status-info {
        margin-left: 0;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 8px 4px;
    }

    .itinerary-container {
        padding: 10px;
        margin: 5px;
    }

    .itinerary-table {
        font-size: 11px;
    }
}
