/* =========================================================
   DIMA MANAGER - GLOBAL STYLE.CSS
   Template inspiration: Inventory dashboard violet / white
   Path: assets/css/style.css
========================================================= */

/* =======================
   1. VARIABLES GLOBALES
======================= */

:root {
    --primary: #7b2ff7;
    --primary-dark: #5c12c9;
    --primary-light: #b98cff;
    --primary-soft: #eadcff;

    --secondary: #9d5cff;

    --bg-main: #f4f4f6;
    --bg-sidebar: #7b2ff7;
    --bg-sidebar-dark: #5b12c6;
    --bg-card: #ffffff;

    --text-main: #111111;
    --text-muted: #777777;
    --text-light: #ffffff;
    --text-purple: #5c12c9;

    --border-light: #e8e8ee;
    --shadow-soft: 0 8px 22px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 12px 30px rgba(123, 47, 247, 0.18);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;

    --sidebar-width: 230px;
    --topbar-height: 64px;

    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --info: #2563eb;

    --font-main: "Inter", "Segoe UI", Arial, sans-serif;
}

/* =======================
   2. RESET GLOBAL
======================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: var(--font-main);
    background: var(--bg-main);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

img {
    max-width: 100%;
    display: block;
}

/* =======================
   3. STRUCTURE APP
======================= */

.app {
    display: flex;
    min-height: 100vh;
    background: var(--bg-main);
}

.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    padding: 22px 32px 32px;
}

/* Variante utile si tu veux une page sans sidebar */
.main-content.full {
    margin-left: 0;
    width: 100%;
}

/* =======================
   4. SIDEBAR
======================= */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    padding: 18px 0;
    z-index: 1000;
    border-top-right-radius: 0;
    border-bottom-right-radius: 12px;
}

.sidebar-logo {
    padding: 0 24px 28px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.sidebar-logo span {
    color: #ffffff;
}

.sidebar-menu {
    flex: 1;
    padding: 0 8px;
}

.sidebar-menu a,
.sidebar-bottom a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 18px;
    margin-bottom: 6px;
    border-radius: 8px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    transition: 0.25s ease;
}

.sidebar-menu a i,
.sidebar-bottom a i {
    font-size: 15px;
    width: 20px;
    text-align: center;
}

.sidebar-menu a:hover,
.sidebar-bottom a:hover {
    background: rgba(255, 255, 255, 0.14);
}

.sidebar-menu a.active,
.sidebar-bottom a.active {
    background: var(--bg-sidebar-dark);
    color: #ffffff;
}

.sidebar-bottom {
    padding: 0 8px;
    margin-top: auto;
}

/* =======================
   5. TOPBAR
======================= */

.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 26px;
}

.search-box {
    width: 320px;
    max-width: 100%;
    position: relative;
}

.search-box input {
    width: 100%;
    height: 38px;
    border: 1.5px solid var(--primary);
    border-radius: 14px;
    outline: none;
    padding: 0 18px;
    background: #ffffff;
    color: var(--text-main);
    font-size: 14px;
    transition: 0.25s ease;
}

.search-box input::placeholder {
    color: var(--primary);
    opacity: 0.7;
}

.search-box input:focus {
    box-shadow: 0 0 0 4px rgba(123, 47, 247, 0.12);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

.topbar-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--primary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: 0.25s ease;
    font-size: 17px;
}

.topbar-icon:hover {
    background: var(--primary-soft);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary);
    color: #ffffff;
    display: grid;
    place-items: center;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(123, 47, 247, 0.35);
}

/* =======================
   6. TITRES DE PAGE
======================= */

.page-title {
    font-size: 30px;
    font-weight: 800;
    color: #050505;
    margin-bottom: 28px;
    letter-spacing: -0.6px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: -18px;
    margin-bottom: 24px;
}

.section-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 16px;
}

/* =======================
   7. CARTES KPI
======================= */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-bottom: 28px;
}

.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 18px 16px;
    min-height: 116px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: 0.25s ease;
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.kpi-value {
    font-size: 28px;
    font-weight: 900;
    color: var(--primary-dark);
    line-height: 1;
}

.kpi-unit {
    font-size: 12px;
    color: var(--primary);
    margin-top: 6px;
}

.kpi-label {
    margin-top: 10px;
    font-size: 11px;
    font-weight: 800;
    color: #050505;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* =======================
   8. GRILLES DASHBOARD
======================= */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 18px;
    margin-bottom: 18px;
}

.dashboard-grid-3 {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 18px;
    margin-bottom: 18px;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-soft);
    transition: 0.25s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.card-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-main);
}

.card-link {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    transition: 0.25s ease;
}

.card-link:hover {
    color: var(--primary);
}

/* =======================
   9. BOUTONS
======================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 18px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
    transition: 0.25s ease;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(123, 47, 247, 0.28);
}

.btn-secondary {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.btn-secondary:hover {
    background: #ddc7ff;
}

.btn-light {
    background: #ffffff;
    color: var(--primary);
    border: 1px solid var(--border-light);
}

.btn-light:hover {
    background: var(--primary-soft);
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-success {
    background: var(--success);
    color: #ffffff;
}

.btn-success:hover {
    background: #15803d;
}

.btn-sm {
    min-height: 30px;
    padding: 0 12px;
    font-size: 12px;
    border-radius: 8px;
}

.btn-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: 0.25s ease;
}

.btn-icon:hover {
    background: var(--primary);
    color: #ffffff;
}

/* =======================
   10. TABLEAUX
======================= */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead th {
    text-align: left;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 800;
    padding: 12px 10px;
    border-bottom: 1px solid var(--border-light);
    text-transform: uppercase;
}

.table tbody td {
    padding: 14px 10px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-main);
    font-size: 14px;
}

.table tbody tr:hover {
    background: #faf7ff;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =======================
   11. FORMULAIRES
======================= */

.form-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-soft);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full {
    grid-column: 1 / -1;
}

label {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-main);
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border-light);
    background: #ffffff;
    color: var(--text-main);
    border-radius: 10px;
    padding: 11px 13px;
    font-size: 14px;
    outline: none;
    transition: 0.25s ease;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(123, 47, 247, 0.12);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 22px;
}

/* =======================
   12. BADGES / STATUTS
======================= */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.badge-primary {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-muted {
    background: #eeeeee;
    color: #666666;
}

/* Statuts missions */

.status-todo {
    background: #eeeeee;
    color: #555555;
}

.status-progress {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-submitted {
    background: #fef3c7;
    color: #92400e;
}

.status-validated {
    background: #dcfce7;
    color: #166534;
}

.status-refused,
.status-late {
    background: #fee2e2;
    color: #991b1b;
}

.status-blocked {
    background: #ffedd5;
    color: #9a3412;
}

/* =======================
   13. CARTES MISSIONS
======================= */

.mission-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.mission-card {
    background: #ffffff;
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-soft);
    border-left: 5px solid var(--primary);
    transition: 0.25s ease;
}

.mission-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.mission-title {
    font-size: 16px;
    font-weight: 900;
    margin-bottom: 8px;
}

.mission-description {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 14px;
}

.mission-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.mission-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #eeeeee;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
}

/* =======================
   14. CALENDRIER
======================= */

.calendar-box {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-soft);
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

.calendar-day-name {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
}

.calendar-day {
    min-height: 95px;
    background: #fafafa;
    border-radius: 12px;
    padding: 10px;
    border: 1px solid #eeeeee;
    transition: 0.25s ease;
}

.calendar-day:hover {
    border-color: var(--primary);
    background: #fbf8ff;
}

.calendar-date {
    font-weight: 900;
    font-size: 13px;
    margin-bottom: 8px;
}

.calendar-event {
    background: var(--primary-soft);
    color: var(--primary-dark);
    padding: 5px 7px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 5px;
}

/* =======================
   15. DOCUMENTS / DRIVE
======================= */

.document-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.document-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-soft);
    transition: 0.25s ease;
}

.document-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.document-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid;
    place-items: center;
    font-size: 24px;
    margin-bottom: 14px;
}

.document-title {
    font-size: 15px;
    font-weight: 900;
    margin-bottom: 6px;
}

.document-desc {
    color: var(--text-muted);
    font-size: 13px;
}

/* =======================
   16. ONBOARDING
======================= */

.onboarding-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.onboarding-item {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.onboarding-check {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid;
    place-items: center;
    font-weight: 900;
    flex-shrink: 0;
}

.onboarding-content h3 {
    font-size: 16px;
    font-weight: 900;
    margin-bottom: 5px;
}

.onboarding-content p {
    color: var(--text-muted);
    font-size: 13px;
}

/* =======================
   17. NOTIFICATIONS
======================= */

.notification-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notification-item {
    background: #ffffff;
    border-radius: 12px;
    padding: 15px;
    box-shadow: var(--shadow-soft);
    display: flex;
    gap: 12px;
    border-left: 5px solid var(--primary);
}

.notification-item.unread {
    background: #fbf8ff;
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.notification-title {
    font-weight: 900;
    margin-bottom: 3px;
}

.notification-message {
    color: var(--text-muted);
    font-size: 13px;
}

.notification-time {
    color: #999999;
    font-size: 11px;
    margin-top: 5px;
}

/* =======================
   18. PAGE LOGIN
======================= */

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #7b2ff7 0%, #b98cff 100%);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 22px;
    padding: 34px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}

.auth-logo {
    font-size: 26px;
    font-weight: 900;
    color: var(--primary);
    text-align: center;
    margin-bottom: 10px;
}

.auth-title {
    text-align: center;
    font-size: 22px;
    font-weight: 900;
    margin-bottom: 8px;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 26px;
}

.auth-card .btn {
    width: 100%;
    margin-top: 8px;
}

/* =======================
   19. ALERTES
======================= */

.alert {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 18px;
    font-size: 14px;
    font-weight: 700;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
}

/* =======================
   20. PROFIL UTILISATEUR
======================= */

.profile-box {
    background: #ffffff;
    border-radius: var(--radius-md);
    padding: 22px;
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    gap: 18px;
}

.profile-photo {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary-soft);
}

.profile-placeholder {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    background: var(--primary);
    color: #ffffff;
    display: grid;
    place-items: center;
    font-size: 30px;
    font-weight: 900;
}

.profile-name {
    font-size: 22px;
    font-weight: 900;
}

.profile-role {
    color: var(--primary);
    font-weight: 800;
}

.profile-meta {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 5px;
}

/* =======================
   21. UTILITAIRES
======================= */

.text-primary {
    color: var(--primary);
}

.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

.hidden {
    display: none !important;
}

/* =======================
   22. RESPONSIVE
======================= */

@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .mission-list {
        grid-template-columns: repeat(2, 1fr);
    }

    .document-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    :root {
        --sidebar-width: 210px;
    }

    .dashboard-grid,
    .dashboard-grid-3 {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .document-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 18px;
    }

    .topbar {
        height: auto;
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .topbar-actions {
        justify-content: flex-end;
    }

    .search-box {
        width: 100%;
    }

    .page-title {
        font-size: 25px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .mission-list {
        grid-template-columns: 1fr;
    }

    .document-grid {
        grid-template-columns: 1fr;
    }

    .calendar-grid {
        gap: 6px;
    }

    .calendar-day {
        min-height: 72px;
        padding: 7px;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 14px;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .card,
    .form-card,
    .calendar-box {
        padding: 16px;
    }

    .profile-box {
        flex-direction: column;
        align-items: flex-start;
    }

    .table thead {
        display: none;
    }

    .table,
    .table tbody,
    .table tr,
    .table td {
        display: block;
        width: 100%;
    }

    .table tbody tr {
        background: #ffffff;
        margin-bottom: 12px;
        border-radius: 12px;
        padding: 12px;
        box-shadow: var(--shadow-soft);
    }

    .table tbody td {
        border-bottom: none;
        padding: 7px 0;
    }
}
