/* ============================================================
   Reset & Base
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f4f6f9; color: #333; }
a { color: #2d6cdf; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   Buttons
   ============================================================ */
.btn { display: inline-block; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-size: 14px; border: none; font-weight: 500; transition: background 0.15s; }
.btn-primary { background: #2d6cdf; color: white; }
.btn-primary:hover { background: #1e56c8; text-decoration: none; color: white; }
.btn-danger { background: #dc3545; color: white; }
.btn-danger:hover { background: #c82333; text-decoration: none; color: white; }
.btn-secondary { background: #6c757d; color: white; }
.btn-secondary:hover { background: #5a6268; text-decoration: none; color: white; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-outline-secondary { background: transparent; border: 1px solid #6c757d; color: #6c757d; }

/* ============================================================
   Header & Navigation
   ============================================================ */
header { background: #1a1f2e; color: white; }

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "logo nav logout";
    align-items: center;
    height: 56px;
}

.header-logo { grid-area: logo; }
.nav-menu { grid-area: nav; }
.header-logout { grid-area: logout; justify-self: end; display: flex; align-items: center; }

.header-logo { display: flex; align-items: center; }
header .logo { font-size: 18px; font-weight: 700; color: white; letter-spacing: 0.5px; }
header .logo:hover { text-decoration: none; color: #e0e6f0; }

.nav-menu { display: flex; align-items: center; }

nav a { color: #c0c8d8; font-size: 14px; padding: 0 14px; height: 56px; display: inline-flex; align-items: center; transition: color 0.15s, background 0.15s; }
nav a:hover, nav a.active { color: white; background: rgba(255,255,255,0.08); text-decoration: none; }

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px 8px;
    margin-left: 12px;
    font-size: 22px;
    line-height: 1;
}

.form-inline { display: inline; }
.header-logout { display: flex; align-items: center; }

/* ============================================================
   Breadcrumb
   ============================================================ */
.breadcrumb { background: white; border-bottom: 1px solid #e9ecef; }

.breadcrumb-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 24px;
    font-size: 13px;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 6px;
}

.breadcrumb a { color: #6c757d; }
.breadcrumb a:hover { color: #2d6cdf; }
.breadcrumb-sep { color: #ced4da; }

/* ============================================================
   Layout
   ============================================================ */
.main { padding: 24px; max-width: 1200px; margin: 0 auto; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-title { font-size: 22px; font-weight: 600; }
footer { text-align: center; padding: 20px; color: #6c757d; font-size: 13px; border-top: 1px solid #e9ecef; margin-top: 40px; }

/* ============================================================
   Flash messages
   ============================================================ */
.flash-success { background: #d4edda; border: 1px solid #c3e6cb; color: #155724; padding: 12px 16px; border-radius: 4px; margin-bottom: 16px; }
.flash-error { background: #f8d7da; border: 1px solid #f5c6cb; color: #721c24; padding: 12px 16px; border-radius: 4px; margin-bottom: 16px; }

/* ============================================================
   Badges
   ============================================================ */
.badge { display: inline-block; padding: 3px 8px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge-spam { background: #dc3545; color: white; }
.badge-sent { background: #28a745; color: white; }
.badge-not-sent { background: #6c757d; color: white; }
.badge-en { background: #17a2b8; color: white; }
.badge-fr { background: #007bff; color: white; }
.badge-current { background: #28a745; color: white; }

/* ============================================================
   Tables
   ============================================================ */
table { width: 100%; border-collapse: collapse; background: white; border-radius: 6px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #e9ecef; }
th { background: #f8f9fa; font-weight: 600; font-size: 12px; color: #6c757d; text-transform: uppercase; letter-spacing: 0.5px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }
.table-flat { box-shadow: none; }
.col-label { width: 140px; }

/* ============================================================
   Cards
   ============================================================ */
.card { background: white; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.card-header { padding: 16px 20px; border-bottom: 1px solid #e9ecef; font-weight: 600; font-size: 15px; display: flex; align-items: center; justify-content: space-between; }
.card-body { padding: 20px; }
.card-narrow { max-width: 560px; }
.card-medium { max-width: 480px; }
.card-wide { max-width: 100%; }

/* ============================================================
   Forms
   ============================================================ */
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 14px; }
input[type=text], input[type=password], input[type=email], select { width: 100%; padding: 8px 12px; border: 1px solid #ced4da; border-radius: 4px; font-size: 14px; }
input[type=text]:focus, input[type=password]:focus, select:focus { border-color: #2d6cdf; outline: none; box-shadow: 0 0 0 2px rgba(45,108,223,0.2); }
input[type=file] { padding: 6px; border: 1px dashed #ced4da; border-radius: 4px; width: 100%; font-size: 14px; }
.form-error { color: #dc3545; font-size: 13px; margin-top: 4px; }
.form-hint { margin-top: 4px; }
.form-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; }

/* ============================================================
   Utilities
   ============================================================ */
.empty-state { text-align: center; padding: 48px; color: #6c757d; }
.actions { display: flex; gap: 6px; }
.text-muted { color: #6c757d; font-size: 13px; }
.mb-12 { margin-bottom: 12px; }
.mt-12 { margin-top: 12px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.page-header-actions { display: flex; align-items: center; gap: 10px; }
.pre-wrap { white-space: pre-wrap; }
.preview-img { max-width: 100%; border-radius: 4px; border: 1px solid #e9ecef; }

/* ============================================================
   Dashboard
   ============================================================ */
.dashboard-date { text-align: center; font-size: 24px; font-weight: 700; margin-bottom: 24px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 20px; }
.dashboard-card { background: white; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); overflow: hidden; }
.dashboard-card-title { font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; color: #6c757d; padding: 14px 16px; border-bottom: 1px solid #e9ecef; text-align: center; }
.dashboard-card-body { padding: 16px; }
.dashboard-card-date { text-align: center; margin-top: 10px; }
.file-name { font-weight: 500; margin-bottom: 4px; }
iframe { border: 1px solid #e9ecef; border-radius: 4px; width: 100%; height: 340px; }

/* ============================================================
   Two-column image layout
   ============================================================ */
.two-col-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }

/* ============================================================
   Pagination
   ============================================================ */
.pagination { margin-top: 16px; display: flex; gap: 8px; justify-content: center; align-items: center; }
.pagination-info { line-height: 2; }

/* ============================================================
   Login
   ============================================================ */
body.login-body { background: #1a1f2e; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { background: white; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.3); padding: 40px; width: 380px; }
.login-logo { text-align: center; margin-bottom: 1rem; max-width: 100%; }
.login-logo img { max-width: 100%; }
.login-subtitle { text-align: center; color: #6c757d; font-size: 14px; margin-bottom: 28px; }
.login-body label { display: inline-block; margin-bottom: .5rem; color: #1a1f2e; }
.login-body input[type=text], .login-body input[type=password] { padding: 10px 12px; margin-bottom: 16px; }
.btn-submit { width: 100%; padding: 1rem; background: #2d6cdf; color: white; border: none; border-radius: 4px; font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 1rem; }
.btn-submit:hover { background: #1e56c8; }
.alert { background: #f8d7da; border: 1px solid #f5c6cb; color: #721c24; padding: 10px 14px; border-radius: 4px; margin-bottom: 20px; font-size: 14px; }
.alert-success { background: #d4edda; border: 1px solid #c3e6cb; color: #155724; padding: 10px 14px; border-radius: 4px; margin-bottom: 20px; font-size: 14px; }
.login-forgot { text-align: center; margin-top: 16px; font-size: 14px; }
.login-forgot a { color: #6c757d; }
.login-forgot a:hover { color: #2d6cdf; }
.login-forgot-intro { font-size: 14px; color: #6c757d; margin-bottom: 20px; line-height: 1.5; }
.form-cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ============================================================
   Responsive — mobile (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
    /* Header */
    .header-inner {
        display: flex;
        flex-wrap: wrap;
        height: auto;
        padding: 0 16px;
        grid-template-areas: unset;
        grid-template-columns: unset;
    }

    .header-logo {
        width: 100%;
        height: 56px;
        justify-content: space-between;
    }

    .nav-toggle { display: flex; align-items: center; }

    .nav-menu {
        display: none;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        border-top: 1px solid rgba(255,255,255,0.1);
        padding-bottom: 8px;
    }

    .nav-menu.open { display: flex; }

    nav { display: flex; flex-direction: column; }
    nav a { height: auto; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
    nav a:last-child { border-bottom: none; }

    .header-logout { display: none; grid-area: unset; width: 100%; padding: 8px 0; }
    .header-logout.open { display: flex; justify-content: center; border-top: 1px solid rgba(255,255,255,0.05); }
    .header-logout.open .btn { width: 100%; text-align: center; }

    /* Breadcrumb */
    .breadcrumb-inner { padding: 10px 16px; }

    /* Main content */
    .main { padding: 16px; }

    /* Dashboard */
    .dashboard-grid { grid-template-columns: 1fr; }

    /* Two-column image layout */
    .two-col-grid { grid-template-columns: 1fr; }
}
