/* Professional Clean Design - MQTT Lufthansa */

/* Reset - Only for html/body, not all elements to avoid overriding Metronic styles */
html, body {
    margin: 0;
    padding: 0;
}

/* Mobile: Prevent horizontal overflow */
html {
    overflow-x: hidden;
}


* {
    box-sizing: border-box;
}

/* Ensure Metronic container classes maintain their padding/margin */
.kt-container-fixed {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

/* Mobile narrow: reduce padding on very small screens */
@media (max-width: 380px) {
    .kt-container-fixed {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}

@media (min-width: 1024px) {
    .kt-container-fixed {
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }
}

/* Ensure header container has proper padding */
.kt-header .kt-container-fixed {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

@media (min-width: 1024px) {
    .kt-header .kt-container-fixed {
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }
}

/* Ensure main content container has proper padding */
main#content .kt-container-fixed {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
}

@media (min-width: 1024px) {
    main#content .kt-container-fixed {
        padding-left: 2rem !important;
        padding-right: 2rem !important;
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
}

/* Theme Variables — AppPacker palette */
:root {
    --bg-color: var(--bg, #f8fafc);
    --text-primary: var(--text, #1e293b);
    --text-secondary: var(--text-muted, #64748b);
    --card-bg: var(--bg-card, #ffffff);
    --border-color: var(--border, #e2e8f0);
    --primary-color: var(--primary, hsl(230, 85%, 60%));
    --accent-color: var(--primary, hsl(230, 85%, 60%));
    --shadow-sm: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.06));
    --shadow-md: var(--shadow-md, 0 4px 6px rgba(0,0,0,0.1));
}

/* Dark mode — handled by apppacker-style.css via [data-theme="dark"] / .dark */
body.dark-mode {
    --bg-color: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --card-bg: #1e293b;
    --border-color: #334155;
}

/* Global Clear Button Styling */
.input-with-clear {
    position: relative;
}

.input-with-clear input {
    padding-right: 24px;
}

.clear-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 18px;
    height: 18px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    z-index: 10;
    opacity: 0.5;
    padding: 0;
}

.clear-btn:hover {
    color: var(--text-primary);
    opacity: 0.8;
}

body.dark-mode .clear-btn {
    opacity: 0.4;
}

body.dark-mode .clear-btn:hover {
    opacity: 0.7;
}

/* Flatpickr Mobile Fix - Global */
@media (max-width: 768px) {
    .flatpickr-calendar {
        max-width: calc(100vw - 20px) !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }

    .flatpickr-calendar.open {
        max-width: calc(100vw - 20px) !important;
    }

    .flatpickr-calendar.animate.open {
        max-width: calc(100vw - 20px) !important;
    }

    /* Ensure calendar doesn't overflow on small screens */
    .flatpickr-calendar .flatpickr-days {
        max-width: 100%;
    }

    .flatpickr-calendar .flatpickr-day {
        max-width: 100%;
    }
}

/* Tom Select Styling - Global */
.ts-wrapper {
    width: 100%;
}

.ts-control {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 13px;
}

.ts-control.focus {
    border-color: #FFCC00;
    box-shadow: 0 0 0 2px rgba(255, 204, 0, 0.1);
}

.ts-dropdown {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.ts-dropdown .option {
    color: var(--text-primary);
    padding: 8px 12px;
}

.ts-dropdown .option.active {
    background: rgba(255, 204, 0, 0.1);
    color: var(--text-primary);
}

.ts-dropdown .option.selected {
    background: #FFCC00;
    color: #1B365D;
}

.ts-dropdown .option:hover {
    background: rgba(255, 204, 0, 0.15);
}

body.dark-mode .ts-control {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-mode .ts-dropdown {
    background: var(--card-bg);
    border-color: var(--border-color);
}

body.dark-mode .ts-dropdown .option {
    color: var(--text-primary);
}

body.dark-mode .ts-dropdown .option.selected {
    background: #FFCC00;
    color: #1B365D;
}

/* Mobile Tom Select Fix */
@media (max-width: 768px) {
    .ts-dropdown {
        max-width: calc(100vw - 20px);
    }
    
    .ts-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Color Classes for Reuse */
.color-red { color: #e74c3c; }
.color-green { color: #28a745; }
.color-blue { color: #3498db; }
.color-orange { color: #f39c12; }
.color-purple { color: #9b59b6; }
.color-yellow { color: #f1c40f; }
.color-gray { color: #6c757d; }
.color-dark { color: #343a40; }

.bg-red { background-color: #e74c3c; }
.bg-green { background-color: #28a745; }
.bg-blue { background-color: #3498db; }
.bg-orange { background-color: #f39c12; }
.bg-purple { background-color: #9b59b6; }
.bg-yellow { background-color: #f1c40f; }
.bg-gray { background-color: #6c757d; }
.bg-dark { background-color: #343a40; }

.border-red { border-color: #e74c3c !important; }
.border-green { border-color: #28a745 !important; }
.border-blue { border-color: #3498db !important; }
.border-orange { border-color: #f39c12 !important; }
.border-purple { border-color: #9b59b6 !important; }
.border-yellow { border-color: #f1c40f !important; }
.border-gray { border-color: #6c757d !important; }
.border-dark { border-color: #343a40 !important; }

/* Base */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14px;
}

/* Metronic Layout Structure - All layout classes are provided by Metronic */
/* Removed: .container, .main-container, .kt-wrapper, .kt-container-fixed - use Metronic classes */

/* Header - All header classes are provided by Metronic (kt-header, kt-container-fixed) */
/* Removed: .header, .header-container, .header-content, .header-left, .header-right, .header-logo, .header-search-btn */

.header-avatar {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px;
    min-height: 36px;
    max-width: 36px;
    max-height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    margin-left: 8px;
    padding: 2px;
}

.header-avatar:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: #FFCC00;
    transform: scale(1.05);
}

.header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.header-avatar div {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    font-weight: 600;
}

/* Removed: .lufthansa-logo, .header-title, .header h1, .subtitle - use Metronic header classes */

/* Navigation - All drawer/navigation classes are provided by Metronic (kt-drawer, kt-menu, kt-sidebar) */
/* Ensure drawer is hidden by default (Metronic override) */
#sidebar.hidden,
#navDrawer.hidden {
    display: none !important;
}

/* Ensure drawer is positioned correctly (Metronic override) */
#sidebar,
#navDrawer {
    position: fixed !important;
    z-index: 1050 !important;
    top: 0 !important;
    bottom: 0 !important;
}

/* Drawer Width - Mobile 80%, Desktop 260px */
#sidebar,
#navDrawer {
    width: 80% !important;
    max-width: 260px !important;
}

@media (min-width: 1024px) {
    #sidebar,
    #navDrawer {
        width: 260px !important;
        max-width: 260px !important;
    }
}

/* Drawer: Flex layout so User/Login stays at bottom */
#sidebar,
#navDrawer {
    display: flex !important;
    flex-direction: column !important;
}

#sidebar .kt-sidebar-content,
#navDrawer .kt-sidebar-content {
    flex: 1 1 auto !important;
    min-height: 0 !important; /* Allow shrink so user section stays visible */
    overflow-y: auto !important;
}

#sidebar #drawerUserInfo,
#navDrawer #drawerUserInfo {
    flex-shrink: 0 !important;
    margin-top: auto !important;
}

/* Drawer Line Height - Better readability */
#sidebar .kt-menu-title,
#navDrawer .kt-menu-title {
    line-height: 1.6 !important;
}

#sidebar .kt-menu-link,
#navDrawer .kt-menu-link {
    line-height: 1.5 !important;
    min-height: 44px !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
}

#sidebar .kt-menu-item,
#navDrawer .kt-menu-item {
    margin-bottom: 6px !important;
}

/* Drawer Menu Spacing */
#sidebar .kt-menu,
#navDrawer .kt-menu {
    gap: 4px !important;
}

#sidebar .kt-menu-accordion,
#navDrawer .kt-menu-accordion {
    gap: 4px !important;
}

/* Header Height and Content Spacing */
.kt-header {
    min-height: 70px !important;
}

/* Mobile: Safe area for notched devices (status bar) */
@supports (padding-top: env(safe-area-inset-top)) {
    .kt-header {
        padding-top: env(safe-area-inset-top) !important;
    }
}


/* Removed: old sticky-header offset — header is sticky in the flex layout, no manual offset needed */

/* Removed: All custom drawer classes (.nav-drawer, .nav-toggle, .nav-menu, etc.) - use Metronic kt-drawer and kt-menu */

/* Cards - All card classes are provided by Metronic (kt-card, kt-card-header, kt-card-content) */
/* Metronic 9 Tailwind Card Content Padding Override (if needed) */
.kt-card-content {
    padding: 1.25rem !important; /* p-5 */
}

@media (max-width: 480px) {
    .kt-card-content {
        padding: 1rem !important; /* Slightly less on narrow mobile */
    }
}

@media (min-width: 1024px) {
    .kt-card-content {
        padding: 2.5rem !important; /* lg:p-10 */
    }
}

/* Removed: .card h2, .card h3 - use Metronic kt-card-header */

/* Badges */
.badge, .status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
}

.app-version {
    display: inline-block;
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 9px;
    font-weight: 400;
    line-height: 1.2;
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.7);
    vertical-align: middle;
}

.app-version.production {
    background: rgba(40, 167, 69, 0.2);
    color: rgba(40, 167, 69, 0.9);
}

.app-version.development {
    background: rgba(255, 193, 7, 0.2);
    color: rgba(255, 193, 7, 0.9);
}

.status-badge.arrived {
    background: #d4edda;
    color: #155724;
}

.status-badge.departed {
    background: #d1ecf1;
    color: #0c5460;
}

.status-badge.delayed {
    background: #fff3cd;
    color: #856404;
}

.status-badge.cancelled {
    background: #f8d7da;
    color: #721c24;
}

/* Buttons - All button classes are provided by Metronic (kt-btn) */
/* Removed: button, .btn - use Metronic kt-btn classes */

/* Mobile-friendly button styles - consistent across all pages */
.btn-mobile {
    flex: 1 1 auto;
    min-width: 120px;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    background: var(--primary-color);
    color: white;
    transition: opacity 0.2s;
}

.btn-mobile:hover {
    opacity: 0.9;
}

.btn-row-mobile {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.btn-group-mobile h2 {
    flex: 1 1 100%;
}

@media (min-width: 480px) {
    .btn-mobile { 
        min-width: 140px;
        padding: 10px 14px;
        font-size: 14px;
    }
}

/* Forms - All form classes are provided by Metronic (kt-input, kt-select, etc.) */
/* Removed: input, select, textarea, label - use Metronic kt-input, kt-select classes */

/* Prevent text-transform on specific inputs that should preserve case */
.kt-input.no-uppercase,
input.kt-input.no-uppercase {
    text-transform: none !important;
}

/* Tables - All table classes are provided by Metronic */
/* Removed: table, th, td, tr:hover - use Metronic table classes */

/* Alert classes (used in login.html and content pages) */
.kt-alert {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid;
    font-size: 13.5px;
    margin-bottom: 0.75rem;
}
.kt-alert-danger {
    background: rgba(239,68,68,0.08);
    border-color: rgba(239,68,68,0.3);
    color: #b91c1c;
}
.kt-alert-success {
    background: rgba(34,197,94,0.08);
    border-color: rgba(34,197,94,0.3);
    color: #15803d;
}
.kt-alert-info {
    background: rgba(66,99,235,0.06);
    border-color: rgba(66,99,235,0.2);
    color: #4263eb;
}
.kt-alert-warning {
    background: rgba(245,158,11,0.08);
    border-color: rgba(245,158,11,0.3);
    color: #b45309;
}

/* Messages */
.success, .info, .error, .loading {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 13px;
}

.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.loading {
    background: #e2e3e5;
    color: #383d41;
    border: 1px solid #d6d8db;
}

/* Stats Grid */
.stats-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px;
}

.stat-card h3 {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Theme Toggle */
.theme-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: var(--shadow-md);
    z-index: 100;
}

/* PWA Install Button */
.pwa-install-btn {
    position: fixed;
    bottom: 70px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    z-index: 100;
    display: none;
}

/* PWA Update Notification */
.pwa-update-notification {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px 16px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    transition: top 0.3s;
}

.pwa-update-notification.show {
    top: 16px;
}

.pwa-update-notification button {
    padding: 4px 12px;
    font-size: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .main-container {
        padding: 12px;
    }
    
    /* Removed: .header, .header-content, .header-left, .header h1, .nav-drawer, .card - use Metronic classes */
    
    .stats-dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 6px;
    }
}

/* Charts */
canvas {
    max-width: 100%;
    height: auto;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    padding: 16px;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 4px;
    max-width: 700px;
    margin: 20px auto;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 14px;
    font-weight: 600;
}

.close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 28px;
    height: 28px;
    line-height: 1;
}

#modalHistoryContent {
    padding: 12px;
}

/* History Items */
.history-item {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 8px;
    font-size: 12px;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 12px;
}

.history-item-status {
    font-weight: 600;
}

.history-item-time {
    color: var(--text-secondary);
    font-size: 11px;
}

.history-item-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
}

.history-detail {
    line-height: 1.4;
}

.history-detail strong {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.history-summary {
    background: var(--bg-color);
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 12px;
}

.route-display {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

.history-list h3 {
    font-size: 13px;
    margin-bottom: 8px;
}

.chart-container {
    margin-bottom: 12px;
}

.chart-header {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.chart-timerange {
    font-size: 10px;
    color: var(--text-secondary);
    background: var(--bg-color);
    padding: 2px 6px;
    border-radius: 3px;
}

/* Dashboard Specific Styles */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.status-list-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
}

.status-info {
    flex: 1;
}

.status-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.status-description {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Circular Progress Indicators */
.circle-stat {
    text-align: center;
}

.circle-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 8px;
}

.circle-svg {
    transform: rotate(-90deg);
}

.circle-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.circle-label {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Mini Circles for Subscribers */
.mini-circles {
    display: flex;
    justify-content: space-around;
    gap: 8px;
    margin-top: 8px;
}

.mini-circle {
    text-align: center;
    flex: 1;
}

.mini-circle-wrapper {
    position: relative;
    width: 50px;
    height: 50px;
    margin: 0 auto 4px;
}

.mini-circle-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.mini-circle-label {
    font-size: 9px;
    color: var(--text-secondary);
}

/* Horizontal Bar Chart */
.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bar-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bar-label {
    min-width: 80px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
}

.bar-track {
    flex: 1;
    height: 20px;
    background: #e9ecef;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #1B365D, #2c5aa0);
    border-radius: 4px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
}

.bar-value {
    font-size: 11px;
    font-weight: 600;
    color: white;
}

/* Activity Log */
.activity-container {
    background: var(--card-bg);
    border-radius: 4px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.activity-controls {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.activity-log {
    max-height: 400px;
    overflow-y: auto;
    padding: 0;
}

.activity-item {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 11px;
}

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

.activity-time {
    color: var(--text-secondary);
    font-size: 10px;
    min-width: 65px;
    margin-right: 10px;
}

.activity-type {
    padding: 1px 6px;
    border-radius: 2px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    min-width: 55px;
    text-align: center;
    margin-right: 10px;
}

.activity-type.success {
    background-color: #d4edda;
    color: #155724;
}

.activity-type.error {
    background-color: #f8d7da;
    color: #721c24;
}

.activity-type.warning {
    background-color: #fff3cd;
    color: #856404;
}

.activity-type.info {
    background-color: #d1ecf1;
    color: #0c5460;
}

.activity-message {
    flex: 1;
    color: var(--text-primary);
    font-size: 11px;
}

/* Mobile Activity */
@media (max-width: 768px) {
    .activity-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .activity-time, .activity-type {
        min-width: auto;
        margin-right: 0;
    }
}

/* iOS Style Toggle Switch */
.ios-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.ios-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ios-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 24px;
}

.ios-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.ios-toggle input:checked + .ios-toggle-slider {
    background-color: #2196F3;
}

.ios-toggle input:checked + .ios-toggle-slider:before {
    transform: translateX(20px);
}

body.dark-mode .ios-toggle-slider {
    background-color: #555;
}

body.dark-mode .ios-toggle input:checked + .ios-toggle-slider {
    background-color: #0d8bf2;
}

/* Settings Tabs - Ultra Minimal */
.settings-tabs {
    margin-bottom: 16px;
}

.settings-tab {
    display: inline-block;
    padding: 6px 10px;
    margin: 0 4px 4px 0;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-tab:hover {
    border-color: var(--primary-color);
}

.settings-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ===== Push Notification Modal ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1050 !important; /* Higher than flight-number-dropdown (z-index: 1) */
    overflow-y: auto;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 8px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: #FFCC00;
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    font-size: 13px;
    color: var(--text-secondary);
}

.form-group input[type="text"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.file-upload {
    border: 2px dashed var(--border-color);
    border-radius: 4px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.file-upload:hover {
    border-color: #FFCC00;
    background: rgba(255, 204, 0, 0.05);
}

.file-upload input[type="file"] {
    display: none;
}

.image-preview {
    margin-top: 12px;
    max-width: 100%;
    max-height: 200px;
    border-radius: 4px;
}

.flight-info-box {
    background: rgba(255, 204, 0, 0.1);
    border-left: 4px solid #FFCC00;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 13px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-modal {
    padding: 10px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-cancel:hover {
    background: var(--text-secondary);
}

.btn-send {
    background: #28a745;
    color: white;
}

.btn-send:hover {
    background: #1e7e34;
}

.btn-send:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
}

/* ===== Toggle Cards ===== */
.toggle-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}

.toggle-card {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 8px;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--card-bg);
    text-align: center;
}

.toggle-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-card:hover {
    border-color: #FFCC00;
    transform: translateY(-1px);
}

.toggle-card.checked {
    background: #FFCC00;
    border-color: #FFCC00;
    color: #1B365D;
}

.toggle-card-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.toggle-card-label {
    font-size: 11px;
    font-weight: 600;
}

.target-cards {
    display: grid;
    gap: 8px;
}

.target-card {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    gap: 10px;
}

.target-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.target-card:hover {
    border-color: #FFCC00;
}

.target-card.checked {
    background: #FFCC00;
    border-color: #FFCC00;
    color: #1B365D;
}

.target-card-icon {
    font-size: 18px;
    min-width: 20px;
}

.target-card-content {
    flex: 1;
}

.target-card-title {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 2px;
}

.target-card-desc {
    font-size: 10px;
    opacity: 0.7;
}

/* ==================== PWA STYLES ==================== */

/* PWA Install Prompt */
.pwa-install-prompt {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.pwa-install-prompt.show {
    opacity: 1;
}

.pwa-install-card {
    background: white;
    border-radius: 24px;
    padding: 32px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    animation: slideUp 0.3s ease;
}

.pwa-install-prompt.show .pwa-install-card {
    transform: scale(1);
}

@keyframes slideUp {
    from {
        transform: translateY(40px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.pwa-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    font-size: 28px;
    color: #6c757d;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.pwa-close:hover {
    background: #f8f9fa;
    color: #212529;
}

.pwa-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pwa-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pwa-install-card h3 {
    font-size: 24px;
    font-weight: 700;
    color: #1B365D;
    margin-bottom: 8px;
    text-align: center;
}

.pwa-install-card p {
    color: #6c757d;
    text-align: center;
    margin-bottom: 24px;
    font-size: 15px;
}

.pwa-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
    padding: 20px 0;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
}

.pwa-feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.pwa-feature span:first-child {
    font-size: 24px;
}

.pwa-feature span:last-child {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

.pwa-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pwa-btn-install {
    background: linear-gradient(135deg, #1B365D 0%, #2c5aa0 100%);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(27, 54, 93, 0.3);
}

.pwa-btn-install:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(27, 54, 93, 0.4);
}

.pwa-btn-install:active {
    transform: translateY(0);
}

.pwa-btn-later {
    background: transparent;
    color: #6c757d;
    border: 1px solid #dee2e6;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.pwa-btn-later:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    color: #495057;
}

/* PWA Update Banner */
.pwa-update-banner {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    transition: top 0.4s ease;
    max-width: 500px;
    width: calc(100% - 40px);
}

.pwa-update-banner.show {
    top: 20px;
}

.pwa-update-content {
    background: white;
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    border: 2px solid #FFCC00;
}

.pwa-update-icon {
    font-size: 32px;
    animation: rotate 2s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.pwa-update-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pwa-update-text strong {
    color: #1B365D;
    font-size: 15px;
}

.pwa-update-text span {
    color: #6c757d;
    font-size: 13px;
}

.pwa-update-btn {
    background: #FFCC00;
    color: #1B365D;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.pwa-update-btn:hover {
    background: #ffdb4d;
    transform: translateY(-1px);
}

.pwa-update-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.pwa-update-close:hover {
    background: #f8f9fa;
    color: #212529;
}

/* PWA Success Toast */
.pwa-success-toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    transition: bottom 0.4s ease;
    max-width: 400px;
    width: calc(100% - 40px);
}

.pwa-success-toast.show {
    bottom: 20px;
}

.pwa-success-content {
    background: linear-gradient(135deg, #28a745 0%, #34ce57 100%);
    color: white;
    border-radius: 12px;
    padding: 16px 24px;
    box-shadow: 0 8px 24px rgba(40, 167, 69, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.pwa-success-icon {
    font-size: 24px;
}

/* PWA Indicator (when running as installed app) */
.pwa-indicator {
    position: fixed;
    top: 70px;
    right: 20px;
    background: #28a745;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
    z-index: 9998;
    cursor: help;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
    }
    50% {
        box-shadow: 0 2px 16px rgba(40, 167, 69, 0.6);
    }
}

/* PWA Mode Adjustments */
body.pwa-mode .container {
    padding-top: 68px; /* Extra padding for PWA indicator */
}

/* Dark Mode PWA Styles */
body.dark-mode .pwa-install-card {
    background: #343a40;
}

body.dark-mode .pwa-install-card h3 {
    color: #f8f9fa;
}

body.dark-mode .pwa-install-card p,
body.dark-mode .pwa-feature span:last-child {
    color: #adb5bd;
}

body.dark-mode .pwa-features {
    border-color: #495057;
}

body.dark-mode .pwa-btn-later {
    background: transparent;
    border-color: #495057;
    color: #adb5bd;
}

body.dark-mode .pwa-btn-later:hover {
    background: #495057;
    border-color: #6c757d;
    color: #f8f9fa;
}

body.dark-mode .pwa-update-content {
    background: #343a40;
}

body.dark-mode .pwa-update-text strong {
    color: #FFCC00;
}

body.dark-mode .pwa-update-text span {
    color: #adb5bd;
}

body.dark-mode .pwa-close:hover,
body.dark-mode .pwa-update-close:hover {
    background: #495057;
    color: #f8f9fa;
}

/* Responsive PWA Styles */
@media (max-width: 768px) {
    .pwa-install-card {
        padding: 24px;
    }
    
    .pwa-features {
        gap: 12px;
    }
    
    .pwa-feature span:last-child {
        font-size: 11px;
    }
    
    .pwa-update-banner.show {
        top: 10px;
    }
    
    .pwa-update-content {
        flex-wrap: wrap;
    }
    
    .pwa-update-btn {
        width: 100%;
    }
}


/* PWA Helper Banner (for HTTP connections) */
.pwa-helper-banner {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99998;
    transition: bottom 0.4s ease;
    max-width: 500px;
    width: calc(100% - 40px);
}

.pwa-helper-banner.show {
    bottom: 20px;
}

.pwa-helper-content {
    background: linear-gradient(135deg, #1B365D 0%, #2c5aa0 100%);
    color: white;
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    border: 2px solid #FFCC00;
}

.pwa-helper-icon {
    font-size: 32px;
}

.pwa-helper-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pwa-helper-text strong {
    font-size: 15px;
    color: #FFCC00;
}

.pwa-helper-text span {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
}

.pwa-helper-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 24px;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.pwa-helper-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
    .pwa-helper-banner.show {
        bottom: 10px;
    }
    
    .pwa-helper-content {
        padding: 12px 16px;
    }
    
    .pwa-helper-icon {
        font-size: 24px;
    }
}

/* Ensure flight number dropdowns are visible above notification drawer */
#notifications_drawer .flight-number-dropdown,
#notifications_drawer [data-kt-dropdown] {
    position: relative;
    z-index: 1000 !important; /* Higher than drawer's z-index: 100 */
}

/* Ensure dropdown menus inside drawer are visible and not clipped */
/* Only set high z-index for dropdowns inside notifications drawer */
#notifications_drawer .kt-dropdown-menu,
#notifications_drawer .flight-number-dropdown .kt-dropdown-menu {
    z-index: 10001 !important; /* Much higher than drawer (z-index: 100) */
    position: fixed !important; /* Use fixed positioning to escape container */
    background: var(--card-bg, #ffffff) !important;
    border: 1px solid var(--border-color, #e5e7eb) !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

/* Flight number dropdowns outside drawers/mods should have lower z-index */
/* IMPORTANT: These elements should NEVER appear over modals (z-index: 1000+) or drawers (z-index: 1050+) */
.flight-number-dropdown,
.flight-number-dropdown[data-kt-dropdown],
div[class*="flight-number-dropdown"] {
    z-index: 0 !important; /* Very low z-index - should not appear over modals/drawers - use 0 instead of 1 */
    position: relative !important; /* Relative positioning, not fixed/absolute */
    /* Don't use isolation: isolate here - it prevents dropdown menu from appearing above button */
    /* Don't create stacking context that would prevent dropdown from appearing above */
    transform: none !important; /* Transform creates stacking context */
    will-change: auto !important; /* will-change can create stacking context */
}

/* Ensure flight number buttons/text elements themselves don't have high z-index */
.flight-number-dropdown button,
.flight-number-dropdown [data-kt-dropdown-toggle],
.flight-number-text {
    z-index: 0 !important; /* Lower than dropdown menu (z-index: 999) - use 0 instead of 1 */
    position: relative !important;
    pointer-events: auto !important; /* Allow clicks but ensure z-index is respected */
}

/* Ensure the button doesn't create a stacking context that interferes */
.flight-number-dropdown button[data-kt-dropdown-toggle] {
    z-index: 0 !important; /* Use 0 instead of 1 to ensure it's below dropdown */
    position: relative !important;
    isolation: auto !important; /* Don't create new stacking context */
}

/* Force low z-index even if inline styles are set - use max specificity to override inline styles */
div.flight-number-dropdown[data-kt-dropdown],
div.flight-number-dropdown[data-kt-dropdown][style],
.flight-number-dropdown[style*="z-index"] {
    z-index: 1 !important; /* Override inline z-index styles */
    position: relative !important; /* Prevent fixed/absolute positioning */
}

/* Ensure flight numbers inside modals/drawers are also properly layered */
.modal .flight-number-dropdown,
.kt-modal .flight-number-dropdown,
.modal-content .flight-number-dropdown,
.modal-body .flight-number-dropdown,
.kt-drawer .flight-number-dropdown:not(#notifications_drawer .flight-number-dropdown) {
    z-index: 1 !important;
    position: relative !important;
}

/* Ensure modals have higher z-index than flight number elements */
.modal,
.modal.show,
.kt-modal {
    z-index: 1050 !important; /* Higher than flight-number-dropdown (z-index: 1) */
}

.modal-content {
    z-index: 1051 !important; /* Slightly higher than modal backdrop */
}

.flight-number-dropdown .kt-dropdown-menu {
    z-index: 999 !important; /* Higher than flight number (z-index: 0) but lower than modals (1050) and drawers (1050) */
    position: fixed !important;
    background: #ffffff !important; /* Force solid white background */
    background-color: #ffffff !important; /* Ensure solid background */
    background-image: none !important; /* Remove any background images */
    border: 1px solid var(--border-color, #e5e7eb) !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    min-width: 200px !important;
    max-width: 300px !important;
    padding: 8px 0 !important;
    margin: 0 !important;
    color: var(--text-primary, #000000) !important;
    opacity: 1 !important; /* Ensure fully opaque */
    backdrop-filter: none !important; /* Remove any transparency effects */
    mix-blend-mode: normal !important; /* Prevent blend mode transparency */
    isolation: isolate !important; /* Create new stacking context */
}

/* Ensure dropdown menu has solid background and is positioned correctly */
.flight-number-dropdown .kt-dropdown-menu:not(.hidden) {
    /* Ensure dropdown menu is above button */
    z-index: 1000 !important; /* Higher z-index when visible */
    /* Make sure background is solid */
    background: #ffffff !important;
    background-color: #ffffff !important;
}

/* Ensure dropdown menus are visible when shown */
#notifications_drawer .kt-dropdown-menu:not(.hidden),
.flight-number-dropdown .kt-dropdown-menu:not(.hidden) {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 999 !important; /* Ensure dropdown menu appears above button (z-index: 0) */
    background: #ffffff !important; /* Solid white background */
    background-color: #ffffff !important; /* Ensure solid background */
    background-image: none !important; /* Remove any background images */
    mix-blend-mode: normal !important; /* Prevent blend mode transparency */
    isolation: isolate !important; /* Create new stacking context */
}

/* When dropdown menu is visible, ensure it's above everything with even higher z-index */
.flight-number-dropdown .kt-dropdown-menu:not(.hidden) {
    z-index: 1000 !important; /* Even higher z-index when visible */
}

/* Reduce button visibility when dropdown is visible (but keep it visible for positioning) */
.flight-number-dropdown.dropdown-open button[data-kt-dropdown-toggle],
.flight-number-dropdown.dropdown-open [data-kt-dropdown-toggle],
.flight-number-dropdown:has(.kt-dropdown-menu:not(.hidden)) button[data-kt-dropdown-toggle],
.flight-number-dropdown:has(.kt-dropdown-menu:not(.hidden)) [data-kt-dropdown-toggle] {
    z-index: 0 !important; /* Keep button at low z-index */
    position: relative !important;
    /* Don't hide button - it's needed for dropdown positioning */
}

/* Ensure dropdown menu sub-items also have solid background */
/* flight-number-dropdown uses the default .kt-dropdown-menu-sub background (var(--bg-card)) */

/* Ensure dropdown menus are hidden when hidden */
#notifications_drawer .kt-dropdown-menu.hidden,
.flight-number-dropdown .kt-dropdown-menu.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Prevent overflow clipping in scrollable containers for dropdowns */
/* Note: We can't set overflow: visible on scrollable containers as it breaks scrolling */
/* Instead, we rely on position: fixed for dropdowns to escape the container */
/* The dropdown menu itself uses position: fixed which escapes overflow clipping */

