/* =============================================
   RESPONSIVE.CSS — GpGTP Mobile Optimization
   =============================================
   Ce fichier ne contient QUE des @media queries.
   Il n'affecte RIEN sur les écrans > 768px (PC).
   ============================================= */

/* ── Global resets pour mobile ───────────────── */

/* Empêcher le zoom sur focus (iOS) */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    input[type="time"],
    input[type="tel"],
    input[type="number"],
    input[type="search"],
    textarea,
    select {
        font-size: 16px !important;
    }

    /* Images responsive */
    img {
        max-width: 100%;
        height: auto;
    }

    /* ── Navbar / Hamburger ────────────────────── */

    .navbar {
        padding: 10px 15px !important;
        flex-wrap: wrap;
    }

    .navbar-brand {
        font-size: 16px !important;
        gap: 8px !important;
    }

    .navbar-brand img {
        height: 35px !important;
    }

    .hamburger-btn {
        display: flex !important;
    }

    .navbar-right {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 10px;
        padding-top: 12px;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        margin-top: 10px;
    }

    .navbar-right.open {
        display: flex;
    }

    .navbar-right .nav-user {
        text-align: center;
        font-size: 13px;
    }

    .navbar-right .nav-role {
        align-self: center;
    }

    .navbar-right .nav-btn {
        width: 100%;
        justify-content: center;
        padding: 10px 14px;
        font-size: 14px;
    }

    /* Legacy navbar styles (pages that don't use navbar.php) */
    .navbar h1 {
        font-size: 16px !important;
        gap: 8px !important;
    }

    .navbar img {
        height: 35px !important;
    }

    .user-info {
        display: none;
    }

    .user-info.open {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 10px;
        align-items: center;
        padding-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }

    .logout-btn {
        width: 100%;
        text-align: center;
        padding: 10px 16px !important;
    }

    /* ── Containers ────────────────────────────── */

    .container {
        margin: 15px auto !important;
        padding: 0 10px !important;
    }

    /* ── Welcome card ─────────────────────────── */

    .welcome {
        padding: 20px 15px !important;
        margin-bottom: 20px !important;
    }

    .welcome h2 {
        font-size: 18px !important;
    }

    .welcome p {
        font-size: 13px !important;
    }

    /* ── Menu grid (dashboard) ────────────────── */

    .menu-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .menu-card {
        padding: 18px 15px !important;
    }

    .menu-card h3 {
        font-size: 15px !important;
    }

    .menu-card p {
        font-size: 13px !important;
    }

    .menu-icon {
        font-size: 30px !important;
        margin-bottom: 10px !important;
    }

    /* ── Stats grids ──────────────────────────── */

    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .stats-row {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }

    .stat-card {
        padding: 15px 10px !important;
    }

    .stat-value {
        font-size: 24px !important;
    }

    .stat-label {
        font-size: 11px !important;
    }

    .stat-percentage {
        font-size: 11px !important;
    }

    .stat-icon {
        font-size: 24px !important;
        margin-bottom: 8px !important;
    }

    .stat-box {
        padding: 12px 8px !important;
    }

    .stat-box .stat-num {
        font-size: 22px !important;
    }

    .stat-box .stat-lbl {
        font-size: 10px !important;
    }

    /* ── Cards ─────────────────────────────────── */

    .card {
        padding: 15px !important;
        margin-bottom: 15px !important;
        border-radius: 10px !important;
    }

    /* ── Page titles ──────────────────────────── */

    .page-title h2 {
        font-size: 18px !important;
    }

    .page-title i {
        font-size: 22px !important;
    }

    /* ── Type chooser (conge/sortie/absence) ── */

    .type-chooser {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .type-card {
        padding: 18px !important;
    }

    .type-card .type-icon {
        font-size: 30px !important;
        margin-bottom: 8px !important;
    }

    .type-card h3 {
        font-size: 14px !important;
    }

    .type-card p {
        font-size: 12px !important;
    }

    /* ── Forms ──────────────────────────────────── */

    .form-row {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 12px !important;
    }

    .form-group label {
        font-size: 13px !important;
    }

    .form-group textarea {
        min-height: 80px !important;
    }

    /* ── Buttons ───────────────────────────────── */

    .btn-submit,
    .btn-submit-conge,
    button[type="submit"] {
        padding: 14px !important;
        font-size: 15px !important;
        min-height: 48px;
    }

    .btn {
        padding: 10px 14px !important;
        font-size: 13px !important;
        min-height: 44px;
    }

    .form-actions {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .form-actions .btn,
    .form-actions .btn-submit,
    .form-actions .btn-cancel {
        width: 100% !important;
        justify-content: center !important;
        text-align: center;
    }

    /* ── Filters (gestion pages) ──────────────── */

    .filters {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .filters .row {
        flex-direction: column;
        gap: 8px;
    }

    .filters .row .btn {
        width: 100%;
        justify-content: center;
    }

    .filters input[type="text"],
    .filters select {
        padding: 12px !important;
    }

    /* ── Tables ────────────────────────────────── */

    .card[style*="overflow"],
    div[style*="overflow-x"] {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
    }

    th {
        padding: 10px 8px !important;
        font-size: 11px !important;
    }

    td {
        padding: 10px 8px !important;
        font-size: 13px !important;
    }

    .actions {
        flex-direction: column;
        gap: 5px !important;
    }

    .actions .btn {
        width: 100%;
        justify-content: center;
        font-size: 12px !important;
        padding: 8px 10px !important;
    }

    /* ── Profile (mon_profil.php) ──────────────── */

    .profile-header {
        flex-direction: column !important;
        text-align: center;
        padding: 25px 15px !important;
        gap: 15px !important;
    }

    .profile-avatar {
        width: 80px !important;
        height: 80px !important;
        font-size: 32px !important;
    }

    .profile-info h2 {
        font-size: 20px !important;
    }

    .profile-info p {
        font-size: 13px !important;
    }

    .form-container {
        padding: 20px 15px !important;
    }

    .form-section {
        margin-bottom: 20px !important;
        padding-bottom: 20px !important;
    }

    .section-title {
        font-size: 14px !important;
    }

    /* ── Charts (dashboard) ───────────────────── */

    div[style*="grid-template-columns"][style*="320px"] {
        grid-template-columns: 1fr !important;
    }

    canvas {
        max-height: 220px !important;
    }

    /* ── Alerts ────────────────────────────────── */

    .alert {
        padding: 12px !important;
        font-size: 13px !important;
    }

    /* ── Back button ──────────────────────────── */

    .back-btn {
        font-size: 14px;
        margin-bottom: 15px !important;
    }

    /* ── Badges ────────────────────────────────── */

    .badge {
        font-size: 10px !important;
        padding: 4px 8px !important;
    }

    /* ── Info box ──────────────────────────────── */

    .info-box {
        font-size: 12px !important;
        padding: 12px !important;
    }

    /* ── Empty state ──────────────────────────── */

    .empty-state {
        padding: 25px !important;
    }

    .empty-state i {
        font-size: 36px !important;
    }

    .empty-state h3 {
        font-size: 16px !important;
    }

    /* ── Login page ───────────────────────────── */

    body > .container:only-child,
    body > div.container:first-child:last-child {
        margin: 15px !important;
        padding: 25px !important;
    }

    .logo h1 {
        font-size: 24px !important;
    }

    .logo-img {
        max-width: 80px !important;
    }

    /* ── Print pages — hide on mobile ─────────── */

    /* No special rules needed, print pages work fine */

    /* ── Chips ─────────────────────────────────── */

    .chips {
        gap: 5px !important;
    }

    .chip {
        font-size: 11px !important;
    }

    /* ── Generic flex/grid header rows ─────────── */

    div[style*="display:flex"][style*="justify-content:space-between"] {
        flex-direction: column !important;
        gap: 10px !important;
        align-items: stretch !important;
    }

    /* ── Conge specific ───────────────────────── */

    .conge-summary {
        grid-template-columns: 1fr !important;
    }

    .conge-detail {
        padding: 15px !important;
    }

    /* ── Scrollable table wrapper ──────────────── */

    .table-responsive,
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ── Very small screens (< 480px) ──────────── */

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .stats-row {
        grid-template-columns: 1fr !important;
    }

    .stat-value {
        font-size: 20px !important;
    }

    .type-card {
        padding: 15px !important;
    }

    .type-card .type-icon {
        font-size: 24px !important;
    }

    .card {
        padding: 12px !important;
    }

    .navbar-brand {
        font-size: 14px !important;
    }

    .navbar-brand img {
        height: 30px !important;
    }
}

/* ── Hamburger button (hidden on desktop) ──── */

.hamburger-btn {
    display: none;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    font-size: 20px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.hamburger-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}
