/**
 * Styles pour Système de Caisse - Amana Transport VIP
 * Design simple et professionnel
 */

/* Reset et variables */
:root {
    --primary-color: #004d4d;
    --primary-light: #006666;
    --primary-dark: #003333;
    --secondary-color: #ff6b35;
    --secondary-light: #ff8c5f;
    --secondary-dark: #e65520;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --light-bg: #f5f7fa;
    --white: #ffffff;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --border-color: #dfe6e9;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecef 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* Background spécial pour la page de login */
body.login-page {
    background: linear-gradient(135deg,
        var(--primary-color) 0%,
        var(--primary-light) 25%,
        var(--secondary-color) 75%,
        var(--secondary-light) 100%);
    position: relative;
    overflow: hidden;
}

body.login-page::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 50%, rgba(255, 107, 53, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 77, 77, 0.3) 0%, transparent 50%);
    animation: gradientMove 15s ease infinite;
    z-index: 0;
}

@keyframes gradientMove {
    0%, 100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(-5%, -5%);
    }
}

/* Navigation */
.navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--white);
    padding: 1rem 0;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.navbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.navbar:hover::before {
    left: 100%;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

@media (max-width: 1200px) {
    .nav-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-menu {
        width: 100%;
        justify-content: flex-start;
        gap: 0.3rem;
    }

    .nav-menu a {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }

    .nav-user {
        width: 100%;
        justify-content: space-between;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        padding-top: 1rem;
    }
}

.nav-brand h1 {
    font-size: 1.5rem;
    margin-bottom: 0.2rem;
}

.nav-subtitle {
    font-size: 0.85rem;
    color: #95a5a6;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

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

.nav-menu a {
    color: var(--white);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s, transform 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    font-size: 0.95rem;
}

.nav-menu a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-user span {
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.4rem 0.8rem;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-logout {
    background-color: var(--danger-color);
    color: var(--white);
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.btn-logout:hover {
    background-color: #c0392b;
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    min-height: calc(100vh - 200px);
}

/* Container */
.container {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.5s ease-out;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.container:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Titres */
h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--secondary-color);
    position: relative;
    animation: slideInLeft 0.6s ease-out;
}

h2::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 80px;
    height: 3px;
    background: var(--secondary-color);
    box-shadow: 0 0 10px var(--secondary-color);
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Alertes */
.alert {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    border-left: 4px solid;
}

.alert-success {
    background-color: #d4edda;
    border-color: var(--success-color);
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: var(--danger-color);
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    border-color: var(--warning-color);
    color: #856404;
}

.alert-info {
    background-color: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

/* Info Box */
.info-box {
    background-color: #e3f2fd;
    border-left: 4px solid var(--secondary-color);
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
}

.info-box strong {
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* Formulaires */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
}

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

/* Boutons */
button,
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--secondary-dark) 100%);
    color: var(--white);
    position: relative;
    overflow: hidden;
    transform: translateY(0);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--secondary-dark) 0%, var(--secondary-color) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(255, 107, 53, 0.3);
}

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

.btn-success:hover {
    background-color: #229954;
}

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

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-secondary {
    background-color: #95a5a6;
    color: var(--white);
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

/* Tableaux */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

table thead {
    background-color: var(--primary-color);
    color: var(--white);
}

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

table tbody tr:hover {
    background-color: #f8f9fa;
}

table .montant {
    text-align: right;
    font-weight: 600;
}

table .entree {
    color: var(--success-color);
}

table .sortie {
    color: var(--danger-color);
}

/* Cards Dashboard */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background-color: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border-left: 5px solid var(--secondary-color);
    transition: all 0.3s ease;
    animation: fadeIn 0.6s ease-out;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(255, 107, 53, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.card-primary {
    border-left-color: var(--secondary-color);
}

.card-success {
    border-left-color: var(--success-color);
}

.card-danger {
    border-left-color: var(--danger-color);
}

.card-warning {
    border-left-color: var(--warning-color);
}

.card h3 {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.card .value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* Login Page */
.login-container {
    max-width: 450px;
    margin: 5rem auto;
    background-color: var(--white);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: loginFadeIn 0.8s ease-out;
    position: relative;
    overflow: hidden;
    z-index: 1;
    backdrop-filter: blur(10px);
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.login-container::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 107, 53, 0.05) 0%, transparent 70%);
    border-radius: 50%;
}

@keyframes loginFadeIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.login-header h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
    font-weight: 700;
}

.login-header p {
    color: var(--secondary-color);
    font-size: 1rem;
    font-weight: 500;
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-light);
}

.login-footer .developer-credit {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--primary-color);
}

.login-footer .developer-credit strong {
    color: var(--secondary-color);
    font-weight: 600;
}

/* Chart Container */
.chart-container {
    background-color: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    animation: fadeIn 0.6s ease-out;
}

.chart-container:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.chart-container h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.chart-container canvas {
    max-height: 300px;
}

/* Footer */
.footer {
    background-color: var(--primary-color);
    color: var(--white);
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 3rem;
}

.footer-content p {
    margin: 0.3rem 0;
    font-size: 0.9rem;
}

/* Formulaire de recherche */
.search-form {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: flex-end;
}

.search-form .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* Totaux */
.totaux-box {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    margin-top: 1rem;
}

.totaux-box p {
    margin: 0.5rem 0;
    font-size: 1.1rem;
}

.totaux-box strong {
    color: var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-menu {
        flex-direction: column;
        width: 100%;
        text-align: center;
    }

    .dashboard-cards {
        grid-template-columns: 1fr;
    }

    .search-form {
        flex-direction: column;
    }

    table {
        font-size: 0.9rem;
    }

    table th,
    table td {
        padding: 0.5rem;
    }
}

/* Loader / Spinner */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 77, 77, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.loader-overlay.active {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top: 5px solid var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader-text {
    color: var(--white);
    margin-top: 1rem;
    font-size: 1.1rem;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Animations pour les tableaux */
table tbody tr {
    animation: tableRowFadeIn 0.5s ease-out;
    animation-fill-mode: both;
}

table tbody tr:nth-child(1) { animation-delay: 0.05s; }
table tbody tr:nth-child(2) { animation-delay: 0.1s; }
table tbody tr:nth-child(3) { animation-delay: 0.15s; }
table tbody tr:nth-child(4) { animation-delay: 0.2s; }
table tbody tr:nth-child(5) { animation-delay: 0.25s; }

@keyframes tableRowFadeIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Animation ripple pour les boutons */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(20);
        opacity: 0;
    }
}

/* Impression */
@media print {
    /* Masquer les éléments non nécessaires */
    .navbar,
    .btn,
    .footer,
    .loader-overlay,
    .search-form,
    .info-box {
        display: none !important;
    }

    /* Reset page styles */
    body {
        background: white !important;
        margin: 0;
        padding: 0;
    }

    body.login-page::before {
        display: none;
    }

    .main-content {
        margin: 0;
        padding: 1cm;
        max-width: 100%;
    }

    .container {
        box-shadow: none;
        padding: 0;
        border-radius: 0;
        page-break-inside: avoid;
    }

    /* En-tête du rapport */
    .container h2 {
        text-align: center;
        color: var(--primary-color);
        font-size: 24pt;
        margin-bottom: 1cm;
        padding-bottom: 0.5cm;
        border-bottom: 3px solid var(--secondary-color);
        page-break-after: avoid;
    }

    .container h3 {
        font-size: 14pt;
        margin-top: 0.5cm;
        margin-bottom: 0.3cm;
        color: var(--primary-color);
        page-break-after: avoid;
    }

    /* Informations d'en-tête */
    .print-header {
        display: block !important;
        text-align: center;
        margin-bottom: 1cm;
        padding-bottom: 0.5cm;
        border-bottom: 2px solid #ddd;
    }

    .print-header h1 {
        font-size: 20pt;
        color: var(--primary-color);
        margin-bottom: 0.2cm;
    }

    .print-header p {
        font-size: 12pt;
        color: var(--text-light);
        margin: 0;
    }

    /* Cards dashboard en mode impression */
    .dashboard-cards {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.5cm;
        margin-bottom: 1cm;
        page-break-inside: avoid;
    }

    .card {
        border: 2px solid #ddd !important;
        padding: 0.5cm !important;
        border-radius: 4px;
        box-shadow: none !important;
        page-break-inside: avoid;
        background: white !important;
    }

    .card h3 {
        font-size: 10pt !important;
        margin-bottom: 0.3cm;
        color: var(--text-dark) !important;
    }

    .card .value {
        font-size: 16pt !important;
        color: var(--primary-color) !important;
    }

    /* Tableaux */
    table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 0.5cm;
        margin-bottom: 1cm;
        font-size: 10pt;
        page-break-inside: auto;
    }

    table thead {
        background-color: var(--primary-color) !important;
        color: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    table th {
        padding: 0.3cm;
        border: 1px solid #333;
        font-weight: bold;
        text-align: left;
    }

    table td {
        padding: 0.3cm;
        border: 1px solid #ddd;
    }

    table tbody tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    table tbody tr:nth-child(even) {
        background-color: #f9f9f9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    table .montant {
        text-align: right;
        font-weight: bold;
    }

    table .entree {
        color: #27ae60 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    table .sortie {
        color: #e74c3c !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Totaux */
    .totaux-box {
        background-color: #f5f7fa !important;
        border: 2px solid var(--primary-color);
        padding: 0.5cm;
        margin-top: 0.5cm;
        border-radius: 4px;
        page-break-inside: avoid;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .totaux-box p {
        margin: 0.2cm 0;
        font-size: 11pt;
    }

    .totaux-box strong {
        color: var(--primary-color) !important;
    }

    /* Pied de page d'impression */
    @page {
        margin: 1.5cm 1cm;
        size: A4;

        @bottom-right {
            content: "Page " counter(page) " sur " counter(pages);
            font-size: 9pt;
            color: #7f8c8d;
        }

        @bottom-left {
            content: "Généré le " date;
            font-size: 9pt;
            color: #7f8c8d;
        }

        @bottom-center {
            content: "Amana Transport VIP - Système de Caisse";
            font-size: 9pt;
            color: var(--primary-color);
            font-weight: bold;
        }
    }

    /* Footer personnalisé pour l'impression */
    .print-footer {
        display: block !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        text-align: center;
        font-size: 9pt;
        color: #7f8c8d;
        padding: 0.3cm;
        border-top: 1px solid #ddd;
        background: white;
    }

    .print-footer p {
        margin: 0.1cm 0;
    }

    /* Éviter les sauts de page */
    h2, h3 {
        page-break-after: avoid;
    }

    /* Forcer les sauts de page si nécessaire */
    .page-break {
        page-break-after: always;
    }
}

/* ====================================
   BADGES POUR NOTIFICATIONS
   ==================================== */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    border-radius: 10px;
    margin-left: 5px;
    animation: pulse 2s infinite;
}

.badge-danger {
    background-color: #dc3545;
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.6);
}

.badge-warning {
    background-color: #ffc107;
    color: #212529;
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.6);
}

.badge-info {
    background-color: #17a2b8;
    box-shadow: 0 0 10px rgba(23, 162, 184, 0.6);
}

.badge-success {
    background-color: #28a745;
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.6);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.95;
    }
}
