/**
 * Owly - Stylesheet principal
 * Palette : bleu marine #104690, turquoise #2AAFCC, orange #F5A623
 * Police : Inter (Google Fonts), fallback system-ui
 */

/* ========================================================================= */
/* RESET & BASE                                                               */
/* ========================================================================= */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 400;
    color: #2D3748;
    background: #F5F7FA;
    line-height: 1.6;
}

a {
    color: #2AAFCC;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #1B8FA8;
}

img {
    max-width: 100%;
    height: auto;
}

/* ========================================================================= */
/* TYPOGRAPHY                                                                 */
/* ========================================================================= */
h1, h2, h3, h4 {
    color: #104690;
    font-weight: 600;
    line-height: 1.3;
}

h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 15px; }

.text-secondary {
    color: #8896A6;
}

.text-small {
    font-size: 13px;
}

/* ========================================================================= */
/* BUTTONS                                                                    */
/* ========================================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: #104690;
    color: #ffffff;
}

.btn-primary:hover {
    background: #0D3A78;
    color: #ffffff;
}

.btn-cta, .btn-orange {
    background: #F5A623;
    color: #104690;
    font-weight: 600;
}

.btn-cta:hover, .btn-orange:hover {
    background: #e6961a;
    color: #104690;
}

.btn-outline {
    background: #ffffff;
    color: #2D3748;
    border: 1px solid #E2E8F0;
}

.btn-outline:hover {
    background: #F5F7FA;
    border-color: #CBD5E0;
}

.btn-danger {
    background: #E53E3E;
    color: #ffffff;
}

.btn-danger:hover {
    background: #C53030;
}

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

.btn-full {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ========================================================================= */
/* CARDS                                                                      */
/* ========================================================================= */
.card {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
}

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

.card-header h2, .card-header h3 {
    margin: 0;
}

/* Metric cards */
.metric-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.metric-card .metric-value {
    font-size: 32px;
    font-weight: 700;
    color: #104690;
    line-height: 1.2;
}

.metric-card .metric-label {
    font-size: 13px;
    color: #8896A6;
    margin-top: 4px;
    font-weight: 500;
}

.metric-card .metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    font-size: 20px;
}

/* ========================================================================= */
/* FORMS                                                                      */
/* ========================================================================= */
.form-group {
    margin-bottom: 18px;
    flex: 1;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #4A5568;
    margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group input[type="search"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 14px;
    color: #2D3748;
    background: #ffffff;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #2AAFCC;
    box-shadow: 0 0 0 3px rgba(42, 175, 204, 0.12);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-group input[type="color"] {
    width: 60px;
    height: 40px;
    padding: 2px;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    cursor: pointer;
}

.form-row {
    display: flex;
    gap: 16px;
}

@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

/* Radio/Checkbox cards */
.radio-cards, .checkbox-cards {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.radio-card, .checkbox-card {
    flex: 1;
    min-width: 120px;
}

.radio-card input, .checkbox-card input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-card label, .checkbox-card label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border: 2px solid #E2E8F0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #4A5568;
    text-align: center;
    transition: all 0.2s;
    background: #fff;
}

.radio-card label:hover, .checkbox-card label:hover {
    border-color: #2AAFCC;
    background: #F0FBFE;
}

.radio-card input:checked + label,
.checkbox-card input:checked + label {
    border-color: #F5A623;
    background: #FFF8EB;
    color: #104690;
    font-weight: 600;
}

/* ========================================================================= */
/* TABLES                                                                     */
/* ========================================================================= */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #8896A6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #E2E8F0;
    white-space: nowrap;
}

table td {
    padding: 12px 16px;
    border-bottom: 1px solid #F0F2F5;
    color: #2D3748;
}

table tbody tr:hover {
    background: #F8FAFC;
}

table tbody tr:nth-child(even) {
    background: #FAFBFC;
}

table tbody tr:nth-child(even):hover {
    background: #F0F4F8;
}

/* ========================================================================= */
/* BADGES                                                                     */
/* ========================================================================= */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

.badge-green {
    background: #D4EDDA;
    color: #155724;
}

.badge-orange {
    background: #FFF3CD;
    color: #856404;
}

.badge-red {
    background: #F8D7DA;
    color: #721C24;
}

.badge-gray {
    background: #E2E8F0;
    color: #4A5568;
}

.badge-blue {
    background: #D1ECF1;
    color: #0C5460;
}

/* ========================================================================= */
/* PAGINATION                                                                 */
/* ========================================================================= */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
    padding: 16px 0;
}

.pagination-info {
    font-size: 13px;
    color: #8896A6;
}

/* ========================================================================= */
/* FILTER BAR                                                                 */
/* ========================================================================= */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-bar .filter-btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    background: #fff;
    color: #4A5568;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.filter-bar .filter-btn:hover {
    border-color: #2AAFCC;
    color: #2AAFCC;
}

.filter-bar .filter-btn.active {
    background: #104690;
    color: #fff;
    border-color: #104690;
}

.filter-bar .search-input {
    padding: 8px 14px;
    font-size: 14px;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    outline: none;
    min-width: 220px;
    transition: border-color 0.2s;
}

.filter-bar .search-input:focus {
    border-color: #2AAFCC;
    box-shadow: 0 0 0 3px rgba(42, 175, 204, 0.12);
}

/* ========================================================================= */
/* AUTH PAGES (Login, Inscription, Reset)                                      */
/* ========================================================================= */
.auth-page {
    background: linear-gradient(135deg, #104690 0%, #0D3A78 50%, #104690 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-container {
    width: 100%;
    max-width: 480px;
}

.auth-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 40px 36px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-title {
    text-align: center;
    font-size: 24px;
    color: #104690;
    margin-bottom: 8px;
}

.auth-subtitle {
    text-align: center;
    font-size: 14px;
    color: #8896A6;
    margin-bottom: 28px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: #8896A6;
}

.auth-footer a {
    color: #2AAFCC;
    font-weight: 500;
}

/* ========================================================================= */
/* GRID LAYOUTS                                                                */
/* ========================================================================= */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

@media (max-width: 900px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .grid-4 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
}

/* Two-column layout */
.columns-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 900px) {
    .columns-2 {
        grid-template-columns: 1fr;
    }
}

/* ========================================================================= */
/* TIMELINE (email sequence)                                                   */
/* ========================================================================= */
.email-timeline {
    position: relative;
    padding-left: 32px;
}

.email-timeline::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #E2E8F0;
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
    padding: 16px;
    background: #FAFBFC;
    border-radius: 10px;
    border: 1px solid #F0F2F5;
    transition: background 0.2s;
}

.timeline-item:hover {
    background: #F5F7FA;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -28px;
    top: 20px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
}

.timeline-item.status-envoye::before {
    background: #48BB78;
    box-shadow: 0 0 0 3px rgba(72, 187, 120, 0.2);
}

.timeline-item.status-programme::before {
    background: #F5A623;
    box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.2);
}

.timeline-item.status-erreur::before {
    background: #E53E3E;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.2);
}

.timeline-item.status-annule::before,
.timeline-item.status-skip::before {
    background: #A0AEC0;
    box-shadow: 0 0 0 3px rgba(160, 174, 192, 0.2);
}

.timeline-item .tl-code {
    font-size: 12px;
    font-weight: 600;
    color: #8896A6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.timeline-item .tl-subject {
    font-size: 14px;
    font-weight: 500;
    color: #2D3748;
    margin: 4px 0;
}

.timeline-item .tl-date {
    font-size: 12px;
    color: #A0AEC0;
}

.timeline-item .tl-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
}

/* ========================================================================= */
/* UTILITIES                                                                   */
/* ========================================================================= */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.text-center { text-align: center; }
.text-right { text-align: right; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

.hidden { display: none; }

/* ========================================================================= */
/* FLASH MESSAGES                                                              */
/* ========================================================================= */
.flash-message {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    animation: flashIn 0.3s ease;
}

@keyframes flashIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================================================= */
/* RESPONSIVE HELPERS                                                          */
/* ========================================================================= */
@media (max-width: 600px) {
    .auth-card {
        padding: 28px 20px;
    }

    h1 { font-size: 22px; }
    h2 { font-size: 18px; }

    table {
        font-size: 13px;
    }

    table th, table td {
        padding: 10px 12px;
    }
}

/* ========================================================================= */
/* PRINT                                                                       */
/* ========================================================================= */
@media print {
    .sidebar, .header-bar, .filter-bar, .pagination, .btn {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .content-area {
        margin: 0 !important;
        padding: 0 !important;
    }
}
