/* ==========================================================================
   VARIABLES GLOBALES
   ========================================================================== */
:root {
    --primary-bg: #1e272e;
    --card-bg: #2f3640;
    --accent-color: #948652;
    --accent-hover: #b0a16b;
    --text-light: #f5f6fa;
    --text-muted: #a4b0be;
    --text-dark: #333333;
    
    --success-color: #2ed573;
    --success-bg: rgba(46, 213, 115, 0.2);
    --error-color: #ff4757;
    --error-bg: rgba(255, 71, 87, 0.2);
}

/* ==========================================================================
   RESET & LAYOUT BASE
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f6f9;
    color: var(--text-dark);
    min-height: 100vh;
}

/* ==========================================================================
   STRUCTURE PAGE DE CONNEXION (LOGIN)
   ========================================================================== */
body.login-layout {
    background-color: var(--primary-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
}

.login-container {
    background-color: var(--card-bg);
    padding: 40px 30px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 420px;
}

.login-title {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
}

/* Les labels spécifiques au formulaire de login (fond sombre) */
.login-container .form-group label {
    color: var(--text-light);
    font-weight: 600;
}

/* Réutilisation ou surcharge locale de l'alerte pour le login */
.login-container .alert-danger {
    background-color: var(--error-bg);
    color: var(--error-color);
    border: 1px solid var(--error-color);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
}

/* ==========================================================================
   STRUCTURE CORPS FRONT-OFFICE MOBILE
   ========================================================================== */
.capture-body {
    background-color: var(--primary-bg);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 15px;
}

.front-header {
    text-align: center;
    padding: 20px 0 10px 0;
}

.front-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.front-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 5px;
}

.front-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
}

.capture-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   CHAMPS ET FORMULAIRES FRONT
   ========================================================================== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
}

.form-control {
    width: 100%;
    height: 48px;
    background-color: var(--primary-bg);
    border: 2px solid transparent;
    border-radius: 8px;
    color: #ffffff;
    padding: 0 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, background-color 0.2s;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.form-control:focus {
    border-color: var(--accent-color);
    background-color: rgba(0, 0, 0, 0.2);
}

textarea.form-control {
    height: auto;
    padding: 10px 12px;
    resize: none;
}

select.form-control {
    background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23948652'%3E%3Cpolygon points='0,20 100,20 50,80'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: 12px;
    background-position: calc(100% - 15px) center;
    padding-right: 40px;
}

.camera-trigger-box {
    position: relative;
    margin: 22px 0;
}

.input-file-hidden {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.camera-btn-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.2);
    border: 2px dashed var(--accent-color);
    border-radius: 12px;
    padding: 25px 15px;
    text-align: center;
    transition: background-color 0.2s, border-color 0.2s;
}

.camera-icon {
    font-size: 2.2rem;
    margin-bottom: 6px;
}

.file-status-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.btn-submit {
    width: 100%;
    height: 52px;
    background-color: var(--accent-color);
    border: none;
    border-radius: 10px;
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(148, 134, 82, 0.3);
    transition: background-color 0.2s, opacity 0.2s;
}

.btn-submit:active {
    background-color: var(--accent-hover);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==========================================================================
   ALERTES GÉNÉRALES
   ========================================================================== */
.alert {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
}
.alert-success { background-color: var(--success-bg); color: var(--success-color); border: 1px solid var(--success-color); }
.alert-error { background-color: var(--error-bg); color: var(--error-color); border: 1px solid var(--error-color); }

.front-footer {
    text-align: center;
    padding: 20px 0;
    font-size: 0.85rem;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.front-footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.front-footer a:hover {
    color: var(--accent-color);
}

/* ==========================================================================
   LAYOUT STRUCTUREL DE L'ADMINISTRATION (BACKOFFICE)
   ========================================================================== */
body.admin-layout {
    background-color: #f4f6f9;
    color: #333;
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 240px;
    background-color: #1e272e;
    color: #fff;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar-brand {
    padding: 20px;
    font-size: 1.3rem;
    font-weight: bold;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    flex: 1;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: #a4b0be;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-menu li a:hover, .sidebar-menu li.active a {
    color: #fff;
    background-color: rgba(255,255,255,0.05);
}

.sidebar-menu li.active a {
    border-left: 4px solid var(--accent-color);
    background-color: rgba(255,255,255,0.08);
}

.admin-container {
    margin-left: 240px;
    width: calc(100% - 240px);
    display: flex;
    flex-direction: column;
}

.admin-topbar {
    height: 60px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 30px;
}

.admin-user-info {
    margin-right: 15px;
    font-weight: 500;
    color: #64748b;
}

.admin-logout-btn {
    color: #ef4444;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.admin-content {
    padding: 30px;
    flex: 1;
}

/* ==========================================================================
   COMPOSANTS DES PAGES DU BACKOFFICE (CARTES BLANCHES)
   ========================================================================== */
.header-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.header-box h1 {
    font-size: 1.6rem;
    color: #1e293b;
    font-weight: 700;
}

.btn-nav {
    background: var(--accent-color);
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 6px;
    color: #fff;
    font-weight: bold;
    font-size: 0.85rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: background 0.2s;
}

.btn-nav:hover {
    background: var(--accent-hover);
}

.content-card {
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    margin-bottom: 30px;
    border: 1px solid #e2e8f0;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-grid-admin {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
}

.filter-control {
    width: 100%;
    height: 40px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0 12px;
    font-size: 0.9rem;
    background-color: #fff;
    color: #333;
    outline: none;
}

.filter-control:focus {
    border-color: var(--accent-color);
}

.btn-submit-admin {
    height: 40px;
    background: #10b981;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.btn-submit-admin:hover {
    background: #059669;
}

/* ==========================================================================
   TABLEAUX COMPLETS DU BACKOFFICE
   ========================================================================== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.admin-table th {
    padding: 14px;
    border-bottom: 2px solid #e2e8f0;
    color: #64748b;
    font-weight: 600;
    text-transform: none;
    font-size: 0.85rem;
    background-color: #f8fafc;
    text-align: left;
}

.admin-table td {
    padding: 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #475569;
    background-color: #fff;
}

.admin-table tr:hover td {
    background-color: #f8fafc;
}

.td-id {
    color: #64748b;
    font-family: monospace;
}

.td-bold {
    color: #1e293b;
    font-weight: 600;
}

.code-badge {
    background: #f1f5f9;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    font-family: monospace;
}

.td-date {
    color: #64748b;
    font-size: 0.85rem;
}

/* Badges spécifiques au backoffice */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.8rem;
}

.badge-admin {
    background-color: #fef3c7;
    color: #d97706;
    border: 1px solid #fde68a;
}

.badge-collab {
    background-color: #e0f2fe;
    color: #0284c7;
    border: 1px solid #bae6fd;
}