/* ===== Admin Panel - Artisans & Plus ===== */
/* ========== Thème Orange ========== */

:root,
[data-bs-theme="light"] {
    --bs-primary: #e67e22;
    --bs-primary-rgb: 230, 126, 34;
    --bs-link-color: #e67e22;
    --bs-link-color-rgb: 230, 126, 34;
    --bs-link-hover-color: #cf6d17;
    --bs-link-hover-color-rgb: 207, 109, 23;
    --sidebar-width: 250px;
    --primary-color: #e67e22;
    --primary-hover: #cf6d17;
    --primary-light: #fdf2e9;
    --sidebar-bg: #2c2c2c;
}

/* Override Bootstrap primary buttons */
.btn-primary {
    --bs-btn-bg: var(--primary-color);
    --bs-btn-border-color: var(--primary-color);
    --bs-btn-hover-bg: var(--primary-hover);
    --bs-btn-hover-border-color: var(--primary-hover);
    --bs-btn-active-bg: #b85c14;
    --bs-btn-active-border-color: #b85c14;
    --bs-btn-disabled-bg: var(--primary-color);
    --bs-btn-disabled-border-color: var(--primary-color);
}

.btn-outline-primary {
    --bs-btn-color: var(--primary-color);
    --bs-btn-border-color: var(--primary-color);
    --bs-btn-hover-bg: var(--primary-color);
    --bs-btn-hover-border-color: var(--primary-color);
    --bs-btn-active-bg: var(--primary-hover);
    --bs-btn-active-border-color: var(--primary-hover);
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

.badge.bg-primary {
    background-color: var(--primary-color) !important;
}

.border-primary {
    border-color: var(--primary-color) !important;
}

.bg-primary.bg-opacity-10 {
    background-color: var(--primary-light) !important;
}

/* ========== Sidebar ========== */
.sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    height: 100vh;
    transition: transform 0.3s ease, margin-left 0.3s ease;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    overflow: hidden;
    background: linear-gradient(180deg, #2c2c2c 0%, #1a1a1a 100%);
    display: flex;
    flex-direction: column;
}

.sidebar .sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    flex-shrink: 0;
}

.sidebar nav {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    flex-wrap: nowrap !important;
    padding-bottom: 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}

.sidebar nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar nav::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,0.3);
    border-radius: 10px;
}

.sidebar nav::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255,255,255,0.5);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 8px;
}

.sidebar-brand {
    color: #e67e22;
    font-weight: 700;
}

.sidebar.collapsed {
    margin-left: calc(-1 * var(--sidebar-width));
}

#page-content-wrapper {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    min-height: 100vh;
}

#page-content-wrapper.expanded {
    margin-left: 0;
}

.sidebar-link {
    color: #94a3b8 !important;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 2px;
    font-size: 0.9rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.sidebar-link:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #e2e8f0 !important;
}

.sidebar-link.active {
    background-color: var(--primary-color);
    color: #ffffff !important;
}

/* ========== Overlay mobile ========== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1030;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
}

/* ========== Stats Card ========== */
.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* ========== Tables ========== */
.table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    font-weight: 600;
    white-space: nowrap;
}

.table td {
    font-size: 0.85rem;
    vertical-align: middle;
}

/* ========== Cards ========== */
.card {
    border-radius: 12px;
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
}

/* ========== Badge custom ========== */
.badge.bg-purple {
    background-color: #7c3aed !important;
}

/* ========== Login ========== */
.login-container {
    background: linear-gradient(135deg, #fdf2e9 0%, #fbeee6 50%, #fef9f5 100%);
    padding: 1rem;
}

.login-container .card {
    border-top: 4px solid var(--primary-color);
}

.login-container .btn-primary {
    background: linear-gradient(135deg, #e67e22, #f39c12);
    border: none;
}

.login-container .btn-primary:hover {
    background: linear-gradient(135deg, #cf6d17, #e67e22);
}

.login-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

/* ========== Responsive - Tablette ========== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        margin-left: 0 !important;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    #page-content-wrapper {
        margin-left: 0 !important;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

/* ========== Responsive - Mobile ========== */
@media (max-width: 767.98px) {
    .container-fluid {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .card {
        border-radius: 8px;
    }

    .card-body {
        padding: 0.75rem;
    }

    .table th {
        font-size: 0.7rem;
    }

    .table td {
        font-size: 0.8rem;
        padding: 0.4rem 0.5rem;
    }

    /* Stack action buttons vertically on mobile */
    .table .btn-sm {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }

    h3.fw-bold {
        font-size: 1.3rem;
    }

    /* Cards dans le dashboard */
    .card .card-body.text-center h3 {
        font-size: 1.2rem;
    }

    .card .card-body.text-center small {
        font-size: 0.7rem;
    }
}

/* ========== Responsive - Très petit écran ========== */
@media (max-width: 575.98px) {
    .navbar .navbar-text {
        font-size: 0.85rem;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .table-responsive {
        font-size: 0.8rem;
    }

    /* Forms : boutons pleine largeur sur mobile */
    .card-body form .btn {
        font-size: 0.8rem;
    }
}

/* ========== Animations ========== */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== Scrollbar sidebar ========== */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* ========== Utilitaires ========== */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
