
/* Override Ionic default styles for custom theme */
ion-app {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

ion-content {
    --padding-start: 16px;
    --padding-end: 16px;
    --padding-top: 16px;
}

/* Custom header styling */
ion-header ion-toolbar {
    --background: var(--ion-color-primary);
    --color: var(--ion-color-primary-contrast);
}

.title-content h1 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 300;
    color: var(--ion-color-primary-contrast);
}

.title-content p {
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.8;
    color: var(--ion-color-primary-contrast);
}

/* Search section styling */
.search-section {
    margin-bottom: 16px;
}

.search-container {
    position: relative;
}

ion-searchbar {
    --border-radius: 12px;
}

ion-item {
    --border-radius: 12px;
    margin-bottom: 8px;
}

ion-select {
    --placeholder-color: var(--ion-color-medium);
}

/* Card styling */
ion-card {
    border-radius: 16px;
    margin: 16px 0;
}

ion-card-header {
    padding-bottom: 8px;
}

ion-card-title {
    font-size: 1.3rem;
    font-weight: 600;
}

ion-card-subtitle {
    color: var(--ion-color-medium);
    font-size: 0.9rem;
}

ion-chip {
    font-size: 0.85rem;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 16px;
    right: 16px;
    background: var(--ion-item-background);
    border-radius: 12px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: var(--ion-box-shadow);
    margin-top: 8px;
    border: 1px solid var(--ion-item-border-color);
}

.search-result {
    padding: 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--ion-item-border-color);
    transition: background-color 0.2s ease;
}

.search-result:hover {
    background-color: var(--ion-color-light);
}

.search-result:active {
    background-color: var(--ion-color-primary-tint);
}

.search-result:last-child {
    border-bottom: none;
}

.airport-name {
    font-weight: bold;
}

.airport-details {
    font-size: 0.9rem;
    color: var(--ion-color-medium);
}

.btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
}

.btn:hover {
    background: #2980b9;
}

.btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.btn.success {
    background: #27ae60;
}

.btn.success:hover {
    background: #229954;
}

.content {
    padding: 30px;
}

.airport-info {
    background: #e8f5e8;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid #27ae60;
}

/* Weather section with Ionic styling */
.weather-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
}

.weather-grid ion-item {
    text-align: center;
    --padding-start: 16px;
    --padding-end: 16px;
}

.weather-grid ion-label h2 {
    font-size: 1.6rem;
    font-weight: bold;
    margin: 0;
}

.weather-grid ion-label p {
    color: var(--ion-color-medium);
    font-size: 0.85rem;
    margin: 4px 0 0 0;
}

ion-note {
    display: block;
    text-align: center;
    margin-top: 16px;
    color: var(--ion-color-medium);
    font-size: 0.8rem;
}

/* Weather age display box */
.weather-age-box {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 16px;
    border: 1px solid;
}

.weather-age-box.fresh {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.weather-age-box.moderate {
    background-color: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

.weather-age-box.stale {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.runway-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-top: 30px;
}

.runway-list {
    border-radius: 10px;
    padding: 20px;
}

.runway-item {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 4px solid #95a5a6;
    transition: all 0.3s ease;
}

.runway-item.best {
    border-left-color: #27ae60;
}

.runway-item.moderate {
    border-left-color: #f39c12;
}

.runway-item.high {
    border-left-color: #e74c3c;
}

.runway-header {
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--ion-text-color);
}

.runway-data {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 0.9rem;
}

/* Canvas and diagram styling */
.canvas-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 75%;
    border-radius: 12px;
    overflow: hidden;
}

@media (max-width: 600px) {
    .canvas-wrapper {
        padding-bottom: 100%; /* Square on mobile for compass */
    }
}

#runway-diagram {
    position: absolute;
    top: 0;
    touch-action: manipulation; /* Prevents double-tap zoom */
    -webkit-touch-callout: none; /* Prevents callout on long press */
    -webkit-user-select: none;
    user-select: none;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.status {
    text-align: center;
    padding: 15px;
    margin: 20px 0;
    border-radius: 8px;
    font-weight: bold;
}

.status.loading {
    background: var(--ion-color-primary-tint);
    color: var(--ion-color-primary-contrast);
    border: 1px solid var(--ion-color-primary-shade);
}

.status.error {
    background: var(--ion-color-danger-tint);
    color: var(--ion-color-danger-contrast);
    border: 1px solid var(--ion-color-danger-shade);
}

.status.success {
    background: var(--ion-color-success-tint);
    color: var(--ion-color-success-contrast);
    border: 1px solid var(--ion-color-success-shade);
}

.status.warning {
    background: var(--ion-color-warning-tint);
    color: var(--ion-color-warning-contrast);
    border: 1px solid var(--ion-color-warning-shade);
}

.legend {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
    padding: 15px;
    border-radius: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    margin-right: 8px;
}

.loading-indicator {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

.weather-source {
    margin-top: 10px;
    font-size: 0.8rem;
    color: #7f8c8d;
    text-align: center;
}

.nearest-station {
    background: #e3f2fd;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    font-size: 0.9rem;
    color: #1976d2;
}

/* PWA Install Button */
.install-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    cursor: pointer;
}

.install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    background: linear-gradient(45deg, #764ba2, #667eea);
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    ion-content {
        --padding-start: 8px;
        --padding-end: 8px;
        --padding-top: 8px;
    }
    
    .title-content h1 {
        font-size: 1.2rem;
    }
    
    .title-content p {
        font-size: 0.8rem;
    }
    
    .weather-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
    }
    
    .weather-grid ion-label h2 {
        font-size: 1.3rem;
    }
    
    .canvas-wrapper {
        padding-bottom: 85%;
    }
    
    ion-card {
        margin: 8px 0;
    }
    
    ion-card-title {
        font-size: 1.1rem;
    }
}

@media (max-width: 600px) {
    .canvas-wrapper {
        padding-bottom: 100%;
    }
}