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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(to right, #39C5BB, #33C7D7, #53C7ED, #7EC5F9, #A7C1FB, #CABDF5, #E4BBE8, #F6BCDA, #FFC0CB);
    min-height: 100vh;
    color: #333;
}

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

header {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.5rem;
    color: #39c5bb;
}

nav a {
    text-decoration: none;
    color: #666;
    padding: 8px 16px;
    border-radius: 20px;
    margin-left: 10px;
    transition: all 0.3s;
}

nav a:hover, nav a.active {
    background: #39c5bb;
    color: white;
}

main {
    padding: 30px 0;
}

.search-section {
    margin-top: 30px;
    margin-bottom: 30px;
}

.search-box {
    display: flex;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
}

.search-box input {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.search-box button {
    padding: 12px 30px;
    background: #39c5bb;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.search-box button:hover {
    background: #39c5bb;
}

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

.airport-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.airport-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.airport-card h3 {
    color: #333;
    margin-bottom: 5px;
}

.airport-card .name-en {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.airport-card .code-tags {
    display: flex;
    gap: 8px;
}

.airport-card .icao {
    display: inline-block;
    background: #39c5bb;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;
}

.airport-card .iata {
    display: inline-block;
    background: #ffc0cb;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;
}

.loading, .no-data {
    text-align: center;
    color: white;
    padding: 40px;
    font-size: 1.1rem;
}

.frequency-display {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.15);
}

.airport-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
    flex-wrap: wrap;
}

.airport-header h2 {
    color: #333;
}

.airport-header .name-en-inline {
    color: #666;
    font-size: 0.9rem;
    font-weight: normal;
    margin-left: 10px;
}

.airport-header .icao-code {
    background: #39c5bb;
    color: white;
    padding: 6px 16px;
    border-radius: 15px;
    font-weight: bold;
}

.back-btn {
    margin-left: auto;
    padding: 8px 20px;
    background: #f0f0f0;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.3s;
}

.back-btn:hover {
    background: #e0e0e0;
}

.type-legend {
    margin-bottom: 20px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.legend-title {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
    font-weight: 500;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.frequency-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.frequency-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border-left: 4px solid #39c5bb;
    flex-wrap: wrap;
    gap: 10px;
}

.frequency-item .type {
    font-weight: bold;
    color: #39c5bb;
    min-width: 100px;
    font-size: 1rem;
}

.frequency-item .type-number {
    color: #888;
    font-size: 0.9rem;
}

.frequency-item .pre-remark {
    color: #666;
    font-size: 0.9rem;
}

.frequency-item .frequency {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    min-width: 80px;
}

.frequency-item .unit {
    color: #888;
    font-size: 0.85rem;
}

.frequency-item .post-remark {
    color: #666;
    font-size: 0.9rem;
    font-style: italic;
}

.frequency-item .backup {
    background: #fff3cd;
    color: #856404;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    margin-left: 5px;
}

.frequency-item .default-remark {
    background: #d4edda;
    color: #155724;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
}

.type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: bold;
    margin-right: 8px;
}

.type-badge.d-atis { background: #e3f2fd; color: #1565c0; }
.type-badge.app { background: #f3e5f5; color: #7b1fa2; }
.type-badge.twr { background: #e8f5e9; color: #2e7d32; }
.type-badge.apn { background: #fff3e0; color: #e65100; }
.type-badge.gnd { background: #fce4ec; color: #c2185b; }
.type-badge.delivery { background: #e0f7fa; color: #00838f; }

footer {
    background: rgba(0, 0, 0, 0.2);
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: auto;
}

.admin-section {
    margin-top: 30px;
    margin-bottom: 30px;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.15);
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.admin-header h2 {
    color: #333;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.header-actions button svg {
    margin-right: 6px;
}

.frequency-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.btn-ai-import {
    background: #9c27b0;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    transition: background 0.3s;
}

.btn-ai-import:hover {
    background: #7b1fa2;
}

.preview-table-container {
    overflow-x: auto;
    margin: 15px 0;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    background: #f8f9fa;
    border-radius: 10px;
    overflow: hidden;
}

.preview-table th,
.preview-table td {
    padding: 10px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.preview-table th {
    background: #39c5bb;
    color: white;
    font-weight: 600;
}

.preview-table tr:hover {
    background: #e9ecef;
}

.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.3s;
}

.form-group textarea:focus {
    outline: none;
    border-color: #39c5bb;
}

.btn-primary {
    background: #39c5bb;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #39c5bb;
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
    border: none;
    padding: 10px 24px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

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

.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.btn-danger:hover {
    background: #c82333;
}

.airport-table-container {
    overflow-x: auto;
}

.airport-table {
    width: 100%;
    border-collapse: collapse;
}

.airport-table th, .airport-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.airport-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

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

.airport-table .actions {
    display: flex;
    gap: 8px;
}

.airport-table .actions button {
    padding: 6px 14px;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.3s;
}

.btn-edit {
    background: #39c5bb;
    color: white;
}

.btn-edit:hover {
    background: #ffc0cb;
}

.btn-delete {
    background: #ffc0cb;
    color: white;
}

.btn-delete:hover {
    background: #39c5bb;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-small {
    max-width: 400px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #888;
}

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

.modal-body {
    padding: 25px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.required {
    color: #ffc0cb;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #39c5bb;
}

.frequency-editor {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 15px;
}

.frequency-row {
    display: grid;
    grid-template-columns: 120px 120px 1fr 1fr 40px;
    gap: 10px;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.frequency-row .row-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 5px;
    display: none;
}

.frequency-row input, .frequency-row select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
}

.frequency-row .remove-btn {
    background: #ffc0cb;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1rem;
}

.btn-add-frequency {
    background: #39c5bb;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-add-frequency:hover {
    background: #ffc0cb;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        gap: 15px;
    }

    .search-box {
        flex-direction: column;
    }

    .airport-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .back-btn {
        margin-left: 0;
        margin-top: 10px;
    }

    .frequency-row {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .frequency-row .row-label {
        display: block;
    }

    .frequency-row .remove-btn {
        grid-column: span 2;
        width: 100%;
        border-radius: 8px;
        height: auto;
        padding: 8px;
    }

    .airport-table th:nth-child(3),
    .airport-table td:nth-child(3),
    .airport-table th:nth-child(4),
    .airport-table td:nth-child(4) {
        display: none;
    }
}

.login-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #39C5BB 0%, #33C7D7 50%, #53C7ED 100%);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.login-overlay.show {
    display: flex;
}

.login-box {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-box h2 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 1.5rem;
}

.login-box .form-group {
    margin-bottom: 20px;
}

.login-box .form-actions {
    justify-content: center;
}

.login-box .btn-primary {
    width: 100%;
    padding: 14px 24px;
}

.error-message {
    color: #dc3545;
    text-align: center;
    margin-top: 15px;
    font-size: 0.9rem;
}
