/* History Page Styles */

/* Page header specific to history */
#history-page .page-header h2 {
    color: #2c3e50;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

#history-page .page-header p {
    color: #666;
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 800px;
    margin: 0 auto;
}

/* Vessels table container */
.vessels-table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin: 2rem 0;
}

/* Main vessels table */
.vessels-table {
    width: 90%;
    margin-left: auto;
    margin-right: auto;
    max-width: max-content;
    border-collapse: separate;
    border-spacing: 2px;
    font-family: 'Merriweather Sans', sans-serif;
}

/* Table header styling */
.vessels-table thead th {
    background: #34495e;
    color: white;
    padding: 12px 15px;
    font-weight: 600;
    text-align: left;
    border: none;
}

/* Index header (non-sortable) */
.index-header {
    width: 80px;
    text-align: center !important;
}

/* Sortable headers */
.sortable-header {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    color: #3498db !important;
    text-decoration: none;
}

.sortable-header:hover {
    background: #2c3e50 !important;
    color: #5dade2 !important;
}

/* Table body styling */
.vessels-table tbody td {
    padding: 10px 15px;
    border: none;
    vertical-align: middle;
}

/* Alternating row colors */
.even-row {
    background-color: rgb(207, 218, 218);
}

.odd-row {
    background-color: rgb(166, 212, 212);
}

/* Hover effect for rows */
.vessels-table tbody tr:hover {
    background-color: rgba(52, 152, 219, 0.2) !important;
    transition: background-color 0.2s ease;
}

/* Cell-specific styling */
.index-cell {
    text-align: center;
    font-weight: 600;
    color: #2c3e50;
    width: 80px;
}

.type-cell {
    font-weight: 500;
    color: #34495e;
    width: 150px;
}

.name-cell {
    width: 300px;
}

.vessel-name-link {
    color: #3498db;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.vessel-name-link:hover {
    color: #2980b9;
    text-decoration: underline;
}

.mmsi-cell {
    font-family: 'Courier New', monospace;
    color: #7f8c8d;
    width: 120px;
}

.date-cell {
    color: #5d6d7e;
    width: 150px;
}

/* Loading and error states */
.loading, .error {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
    font-style: italic;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 2rem 0;
}

.error {
    color: #e74c3c;
    background: #fdf2f2;
    border: 1px solid #f5c6cb;
}

/* Responsive design */
@media (max-width: 1024px) {
    .vessels-table-container {
        overflow-x: auto;
    }
    
    .vessels-table {
        min-width: 700px;
    }
    
    .name-cell {
        width: 250px;
    }
    
    .type-cell {
        width: 120px;
    }
}

@media (max-width: 768px) {
    #history-page .page-header h2 {
        font-size: 1.6rem;
    }
    
    #history-page .page-header p {
        font-size: 1rem;
        padding: 0 1rem;
    }
    
    .vessels-table {
        min-width: 600px;
        font-size: 0.9rem;
    }
    
    .vessels-table thead th,
    .vessels-table tbody td {
        padding: 8px 10px;
    }
    
    .name-cell {
        width: 200px;
    }
    
    .type-cell {
        width: 100px;
    }
    
    .date-cell {
        width: 120px;
    }
}

/* Sort indicator styling */
.sortable-header {
    position: relative;
}

/* Custom styling for sort triangles */
.sortable-header:after {
    content: '';
    margin-left: 5px;
}

/* Utility classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

/* Table animation for smooth sorting */
.vessels-table tbody {
    transition: opacity 0.2s ease;
}

.vessels-table tbody.sorting {
    opacity: 0.7;
}

/* ===== VESSEL DETAILS STYLES ===== */

.vessel-details {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.vessel-header {
    background: linear-gradient(135deg, #34495e, #2c3e50);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.back-to-list-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.back-to-list-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.vessel-header h2 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 600;
}

.vessel-info {
    padding: 2rem;
    display: flex;
    gap: 2rem;
    border-bottom: 1px solid #ecf0f1;
}

.vessel-image {
    width: 200px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.vessel-specs {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
}

.vessel-specs p {
    margin: 0.5rem 0;
    color: #34495e;
}

.vessel-specs strong {
    color: #2c3e50;
    min-width: 80px;
    display: inline-block;
}

.passage-info {
    padding: 1.5rem 2rem;
    background: #f8f9fa;
    border-bottom: 1px solid #ecf0f1;
}

.passage-info p {
    margin: 0;
    color: #5d6d7e;
    line-height: 1.6;
}

.passages-table-container {
    padding: 2rem;
    overflow-x: auto;
}

.passages-table {
    width: 90%;
    margin-left: auto;
    margin-right: auto;
    max-width: max-content;
    border-collapse: separate;
    border-spacing: 2px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.passages-table thead th {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    border: none;
    white-space: nowrap;
}

.passages-table thead th:first-child {
    width: 120px;
}

.passages-table tbody td {
    padding: 1rem;
    border-bottom: 1px solid #ecf0f1;
    vertical-align: middle;
}

.passages-table tbody tr:nth-child(even) {
    background-color: rgb(207, 218, 218);
}

.passages-table tbody tr:nth-child(odd) {
    background-color: rgb(166, 212, 212);
}

.passages-table tbody tr:hover {
    background-color: rgba(52, 152, 219, 0.1);
}

.waypoint-cell {
    text-align: center;
    font-size: 0.9rem;
    white-space: nowrap;
}

.direction-icon {
    width: 12px;
    height: 12px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.date-cell {
    font-weight: 600;
    color: #2c3e50;
}

.no-passages {
    padding: 3rem 2rem;
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
}

.no-passages p {
    margin: 0;
    font-size: 1.1rem;
}

/* Responsive design for vessel details */
@media (max-width: 768px) {
    .vessel-header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .vessel-header h2 {
        font-size: 1.4rem;
    }
    
    .vessel-info {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .vessel-image {
        width: 150px;
        align-self: center;
    }
    
    .vessel-specs {
        grid-template-columns: 1fr;
    }
    
    .passage-info {
        padding: 1rem;
    }
    
    .passages-table-container {
        padding: 1rem;
    }
    
    .passages-table {
        font-size: 0.9rem;
    }
    
    .passages-table thead th,
    .passages-table tbody td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .vessel-header {
        padding: 0.75rem;
    }
    
    .vessel-header h2 {
        font-size: 1.2rem;
    }
    
    .back-to-list-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .vessel-info {
        padding: 0.75rem;
    }
    
    .vessel-image {
        width: 120px;
    }
    
    .passage-info {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .passages-table-container {
        padding: 0.75rem;
    }
    
    .passages-table {
        font-size: 0.8rem;
    }
    
    .passages-table thead th,
    .passages-table tbody td {
        padding: 0.5rem 0.25rem;
    }
}
