/* =====================================================
   TurnTrack v1.2
   Main Stylesheet
===================================================== */

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

body{
    font-family:Arial,Helvetica,sans-serif;
    background:#f4f7fb;
    color:#222;
}

/* ===========================
   Header
=========================== */

.top-bar{
    background:#0d47a1;
    color:#fff;
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:16px 20px;
    position:sticky;
    top:0;
    z-index:100;
    box-shadow:0 3px 10px rgba(0,0,0,.15);
}

.logo{
    font-size:24px;
    font-weight:bold;
}

.version{
    background:#1565c0;
    padding:6px 12px;
    border-radius:20px;
    font-size:14px;
}

/* ===========================
   Layout
=========================== */

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

/* ===========================
   Dashboard
=========================== */

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

.dashboard-card{
    background:#fff;
    border-radius:12px;
    padding:18px;
    text-align:center;
    box-shadow:0 4px 12px rgba(0,0,0,.08);
}

.dashboard-card h3{
    color:#1565c0;
    font-size:15px;
    margin-bottom:8px;
}

.dashboard-card p{
    font-size:28px;
    font-weight:bold;
}

/* ===========================
   Toolbar
=========================== */

.toolbar{
    display:flex;
    gap:10px;
    margin-bottom:20px;
    flex-wrap:wrap;
}

#addTurnBtn{
    background:#1976d2;
    color:#fff;
    border:none;
    padding:12px 18px;
    border-radius:8px;
    cursor:pointer;
    font-size:15px;
    transition:.25s;
}

#addTurnBtn:hover{
    background:#0d47a1;
}

#searchFlight{
    flex:1;
    min-width:220px;
    padding:12px;
    border:1px solid #ccc;
    border-radius:8px;
}

/* ===========================
   Flight Cards
=========================== */

#flightList{
    display:flex;
    flex-direction:column;
    gap:16px;
}

.flight-card{
    background:#fff;
    border-left:6px solid #1976d2;
    border-radius:12px;
    padding:18px;
    box-shadow:0 4px 10px rgba(0,0,0,.08);
}

.flight-card h2{
    color:#0d47a1;
    margin-bottom:10px;
}

.flight-card p{
    margin:5px 0;
}
/* ===========================
   Modal
=========================== */

.modal{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.55);
    display:flex;
    justify-content:center;
    align-items:center;
    padding:20px;
    z-index:1000;
}

.hidden{
    display:none;
}

.modal-content{
    background:#fff;
    width:100%;
    max-width:600px;
    border-radius:12px;
    padding:20px;
    box-shadow:0 12px 30px rgba(0,0,0,.25);
}

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

.close-btn{
    background:none;
    border:none;
    font-size:22px;
    cursor:pointer;
}

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

.form-group label{
    display:block;
    margin-bottom:6px;
    font-weight:600;
}

.form-group input,
.form-group textarea{
    width:100%;
    padding:12px;
    border:1px solid #ccc;
    border-radius:8px;
    font-size:15px;
}

.form-group textarea{
    resize:vertical;
}

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

.modal-actions{
    display:flex;
    gap:10px;
    margin-top:20px;
}

.save-btn{
    flex:1;
    background:#1976d2;
    color:#fff;
    border:none;
    padding:12px;
    border-radius:8px;
    cursor:pointer;
    font-size:15px;
}

.save-btn:hover{
    background:#0d47a1;
}

.delete-btn{
    background:#d32f2f;
    color:#fff;
    border:none;
    padding:12px 18px;
    border-radius:8px;
    cursor:pointer;
}

.delete-btn:hover{
    background:#b71c1c;
}

/* ===========================
   Footer
=========================== */

.app-footer{
    text-align:center;
    padding:25px;
    color:#666;
}

/* ===========================
   Loading Overlay
=========================== */

.loading-overlay{
    position:fixed;
    inset:0;
    background:rgba(255,255,255,.85);
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    z-index:2000;
}

.spinner{
    width:50px;
    height:50px;
    border:5px solid #ddd;
    border-top:5px solid #1976d2;
    border-radius:50%;
    animation:spin .8s linear infinite;
    margin-bottom:15px;
}

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

/* ===========================
   Toast Notification
=========================== */

.toast{
    position:fixed;
    left:50%;
    bottom:25px;
    transform:translateX(-50%);
    background:#323232;
    color:#fff;
    padding:12px 18px;
    border-radius:8px;
    box-shadow:0 4px 12px rgba(0,0,0,.2);
    z-index:3000;
}

/* ===========================
   Responsive
=========================== */

@media (max-width:768px){

    .dashboard{
        grid-template-columns:1fr;
    }

    .toolbar{
        flex-direction:column;
    }

    .form-row{
        grid-template-columns:1fr;
    }

    .modal-content{
        padding:16px;
    }

}

/* ===========================
   Dark Mode
=========================== */

@media (prefers-color-scheme: dark){

    body{
        background:#121212;
        color:#f2f2f2;
    }

    .dashboard-card,
    .flight-card,
    .modal-content{
        background:#1e1e1e;
        color:#fff;
    }

    .form-group input,
    .form-group textarea,
    #searchFlight{
        background:#2b2b2b;
        color:#fff;
        border:1px solid #444;
    }

    .app-footer{
        color:#bbb;
    }

}