/* ============================================
   NEWTECS - Panel Admin CSS
   ============================================ */

:root {
    --primary: #091E42;
    --primary-light: #0052CC;
    --secondary: #F4F5F7;
    --success: #36B37E;
    --warning: #FFAB00;
    --danger: #FF5630;
    --info: #00B8D9;
    --dark: #172B4D;
    --light: #FAFBFC;
    --border: #DFE1E6;
    --text: #172B4D;
    --text-light: #6B778C;
    --sidebar-width: 250px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--secondary);
    line-height: 1.5;
}

a {
    color: var(--primary-light);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.login-box {
    background: white;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo img {
    height: 50px;
}

.login-title {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 25px;
}

/* ============================================
   LAYOUT
   ============================================ */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    height: 35px;
}

.sidebar-nav {
    padding: 15px 0;
}

.nav-section {
    padding: 10px 20px 5px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.5);
}

.nav-item {
    display: block;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover, .nav-item.active {
    background: rgba(255,255,255,0.1);
    color: white;
    border-left-color: var(--primary-light);
    text-decoration: none;
}

.nav-item i {
    width: 20px;
    margin-right: 10px;
}

.nav-badge {
    float: right;
    background: var(--danger);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* Header */
.admin-header {
    background: white;
    padding: 15px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-search {
    position: relative;
}

.header-search input {
    padding: 8px 15px 8px 35px;
    border: 1px solid var(--border);
    border-radius: 5px;
    width: 300px;
    font-size: 13px;
}

.header-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    font-weight: 500;
}

.user-avatar {
    width: 35px;
    height: 35px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Page Content */
.page-content {
    padding: 30px;
}

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

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary);
}

.breadcrumb {
    display: flex;
    gap: 10px;
    font-size: 13px;
    color: var(--text-light);
}

.breadcrumb a {
    color: var(--text-light);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

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

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    background: var(--light);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid var(--border);
}

.stat-card.primary { border-left: 4px solid var(--primary-light); }
.stat-card.success { border-left: 4px solid var(--success); }
.stat-card.warning { border-left: 4px solid var(--warning); }
.stat-card.danger { border-left: 4px solid var(--danger); }
.stat-card.info { border-left: 4px solid var(--info); }

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 5px;
}

.stat-icon {
    float: right;
    font-size: 30px;
    color: var(--border);
}

/* ============================================
   TABLES
   ============================================ */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--light);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
}

.table tbody tr:hover {
    background: var(--light);
}

.table-actions {
    display: flex;
    gap: 5px;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    font-size: 13px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.form-text {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 5px;
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-primary {
    background: var(--primary-light);
    color: white;
}

.btn-primary:hover {
    background: var(--primary);
    text-decoration: none;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: var(--dark);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-secondary {
    background: var(--secondary);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--light);
}

/* ============================================
   BADGES / STATUS
   ============================================ */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-nouveau { background: #E3F2FD; color: #1976D2; }
.badge-lu { background: #FFF3E0; color: #F57C00; }
.badge-en_cours { background: #E8F5E9; color: #388E3C; }
.badge-termine { background: #E0F2F1; color: #00796B; }
.badge-accepte { background: #E8F5E9; color: #388E3C; }
.badge-refuse { background: #FFEBEE; color: #D32F2F; }
.badge-archive { background: #ECEFF1; color: #607D8B; }
.badge-brouillon { background: #ECEFF1; color: #607D8B; }
.badge-envoye { background: #E3F2FD; color: #1976D2; }
.badge-payee { background: #E8F5E9; color: #388E3C; }
.badge-planifie { background: #FFF3E0; color: #F57C00; }

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert-success {
    background: #E8F5E9;
    border-color: var(--success);
    color: #2E7D32;
}

.alert-danger {
    background: #FFEBEE;
    border-color: var(--danger);
    color: #C62828;
}

.alert-warning {
    background: #FFF3E0;
    border-color: var(--warning);
    color: #E65100;
}

.alert-info {
    background: #E3F2FD;
    border-color: var(--info);
    color: #0277BD;
}

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    display: none;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}

.modal-body {
    padding: 20px;
}

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

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-light);
}

.empty-state i {
    font-size: 50px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--text);
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 20px;
}

.pagination a, .pagination span {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 13px;
}

.pagination a:hover {
    background: var(--light);
    text-decoration: none;
}

.pagination .active {
    background: var(--primary-light);
    color: white;
    border-color: var(--primary-light);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .header-search input {
        width: 200px;
    }
}

@media (max-width: 576px) {
    .page-content {
        padding: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .header-search {
        display: none;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}
