/* Main Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background-color: #1a3a5f;
    color: white;
    padding: 15px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo i {
    margin-right: 10px;
    font-size: 28px;
}

/* Main Content */
main {
    padding: 30px 0;
}

h2 {
    color: #1a3a5f;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

h2 i {
    margin-right: 10px;
}

/* Search Form */
.search-section {
    background-color: white;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #1a3a5f;
}

label i {
    margin-right: 5px;
}

input[type="text"],
input[type="number"],
input[type="date"],
select {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.date-range,
.range-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.search-btn {
    background-color: #2c5282;
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn i {
    margin-right: 8px;
}

.search-btn:hover {
    background-color: #1a3a5f;
}

/* Custom Select */
.custom-select {
    position: relative;
    width: 100%;
}

.selected-display {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    min-height: 42px;
}

.selected-display:after {
    content: '\f078';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.select-options {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.select-options.show {
    display: block;
}

.vessel-type-option,
.country-option {
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.vessel-type-option:hover,
.country-option:hover {
    background-color: #f5f7fa;
}

.vessel-type-option {
    display: flex;
    align-items: center;
}

.vessel-type-option i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Selected Items */
.selected-items {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.selected-item {
    background-color: #e2e8f0;
    padding: 2px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    font-size: 14px;
}

.remove-btn {
    background: none;
    border: none;
    color: #718096;
    cursor: pointer;
    font-size: 16px;
    margin-left: 5px;
    padding: 0 2px;
}

.remove-btn:hover {
    color: #e53e3e;
}

/* Toggle Buttons */
.toggle-container {
    display: flex;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #ddd;
}

.toggle-container input[type="radio"] {
    display: none;
}

.toggle-btn {
    flex: 1;
    text-align: center;
    padding: 10px;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-btn i {
    margin-right: 5px;
}

.toggle-btn.arrival {
    border-right: 1px solid #ddd;
}

input[type="radio"]:checked + .toggle-btn.arrival {
    background-color: #2c5282;
    color: white;
}

input[type="radio"]:checked + .toggle-btn.departure {
    background-color: #2c5282;
    color: white;
}

/* Category Buttons */
.category-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}

.category-btn {
    background-color: #e2e8f0;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.category-btn:hover {
    background-color: #cbd5e0;
}

/* Helper Text */
.helper-text {
    font-size: 12px;
    color: #718096;
    margin-top: 5px;
}

.helper-text i {
    margin-right: 3px;
}

/* Loading Indicator */
.loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 4px solid #2c5282;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results Section */
.results-section {
    background-color: white;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.active-filters {
    margin-bottom: 20px;
}

.filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-item {
    background-color: #e2e8f0;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
}

/* Tabs */
.result-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 15px;
}

.tab-btn {
    background-color: #f5f7fa;
    border: 1px solid #e2e8f0;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background-color: #2c5282;
    color: white;
    border-color: #2c5282;
}

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

.vessel-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.vessel-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.vessel-header {
    background-color: #f5f7fa;
    padding: 15px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
}

.vessel-flag {
    margin-right: 10px;
}

.vessel-flag img {
    width: 24px;
    height: auto;
    border-radius: 2px;
}

.vessel-name {
    margin: 0;
    font-size: 18px;
    flex: 1;
}

.vessel-info {
    padding: 15px;
}

.info-row {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.info-row span:first-child {
    font-weight: 600;
    color: #4a5568;
}

.vessel-actions {
    padding: 15px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
}

.details-btn {
    background-color: #2c5282;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.details-btn:hover {
    background-color: #1a3a5f;
}

.external-link {
    color: #2c5282;
    text-decoration: none;
    display: flex;
    align-items: center;
}

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

/* Pagination */
.pagination {
    margin-top: 30px;
    display: flex;
    justify-content: center;
}

.load-more-btn {
    background-color: #e2e8f0;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.load-more-btn:hover {
    background-color: #cbd5e0;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background-color: white;
    z-index: 1;
}

.modal-header h2 {
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #718096;
}

.modal-body {
    padding: 20px;
}

/* Detail Tabs */
.detail-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 15px;
}

.tab-content {
    display: none;
}

.vessel-detail-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.detail-flag {
    width: 32px;
    height: auto;
    margin-right: 15px;
    border-radius: 2px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 5px;
}

.external-links {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

/* Port Visits */
.port-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.port-item {
    padding: 15px;
    border-bottom: 1px solid #e2e8f0;
}

.port-item:last-child {
    border-bottom: none;
}

.port-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.port-dates {
    display: flex;
    justify-content: space-between;
    color: #718096;
    font-size: 14px;
}

/* Positions */
.position-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.position-item {
    padding: 15px;
    border-bottom: 1px solid #e2e8f0;
}

.position-item:last-child {
    border-bottom: none;
}

.position-time {
    font-weight: 600;
    margin-bottom: 5px;
}

.position-coords {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.position-details {
    display: flex;
    justify-content: space-between;
    color: #718096;
    font-size: 14px;
}

/* Error Messages */
.error-message {
    background-color: #fed7d7;
    color: #c53030;
    padding: 15px;
    border-radius: 4px;
    margin: 20px 0;
}

.no-results, .no-data {
    text-align: center;
    padding: 30px;
    color: #718096;
}

/* Footer */
footer {
    background-color: #1a3a5f;
    color: white;
    padding: 20px 0;
    text-align: center;
    margin-top: 50px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .port-dates, .position-coords, .position-details {
        flex-direction: column;
        gap: 5px;
    }
}

/* Flag Icons */
.flag-icon {
    width: 24px;
    height: 16px;
    display: inline-block;
    background-size: cover;
    margin-right: 5px;
    vertical-align: middle;
}

/* Vessel Type Icons */
[class^="icon-"] {
    width: 24px;
    height: 24px;
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin-right: 10px;
}

.icon-cargo { background-image: url('/static/img/icons/cargo.svg'); }
.icon-tanker { background-image: url('/static/img/icons/tanker.svg'); }
.icon-passenger { background-image: url('/static/img/icons/passenger.svg'); }
.icon-fishing { background-image: url('/static/img/icons/fishing.svg'); }
.icon-container { background-image: url('/static/img/icons/container.svg'); }
.icon-bulk { background-image: url('/static/img/icons/bulk.svg'); }
.icon-roro { background-image: url('/static/img/icons/roro.svg'); }
.icon-supply { background-image: url('/static/img/icons/supply.svg'); }
.icon-lng { background-image: url('/static/img/icons/lng.svg'); }
.icon-lpg { background-image: url('/static/img/icons/lpg.svg'); }
.icon-oil { background-image: url('/static/img/icons/oil.svg'); }
.icon-chemical { background-image: url('/static/img/icons/chemical.svg'); }
.icon-crude { background-image: url('/static/img/icons/crude.svg'); }
.icon-tug { background-image: url('/static/img/icons/tug.svg'); }
.icon-yacht { background-image: url('/static/img/icons/yacht.svg'); }
.icon-dredger { background-image: url('/static/img/icons/dredger.svg'); }
.icon-reefer { background-image: url('/static/img/icons/reefer.svg'); }
.icon-special { background-image: url('/static/img/icons/special.svg'); }
.icon-military { background-image: url('/static/img/icons/military.svg'); }
.icon-sailing { background-image: url('/static/img/icons/sailing.svg'); }
.icon-icebreaker { background-image: url('/static/img/icons/icebreaker.svg'); }
.icon-research { background-image: url('/static/img/icons/research.svg'); }
.icon-pilot { background-image: url('/static/img/icons/pilot.svg'); }
.icon-hsc { background-image: url('/static/img/icons/hsc.svg'); }
.icon-offshore { background-image: url('/static/img/icons/offshore.svg'); }
.icon-dive { background-image: url('/static/img/icons/dive.svg'); }
.icon-sar { background-image: url('/static/img/icons/sar.svg'); }
.icon-pollution { background-image: url('/static/img/icons/pollution.svg'); }
.icon-law { background-image: url('/static/img/icons/law.svg'); }
.icon-medical { background-image: url('/static/img/icons/medical.svg'); }
