/* ===========================================================
   PALETTE PREMIUM – COHÉRENTE AVEC LE SITE TOUZANI
=========================================================== */
:root {
    --primary: #003366;
    /* Bleu foncé identité */
    --primary-light: #12c7e8;
    /* Bleu cyan du site */
    --primary-hover: #0aa7c5;
    --secondary: #f5faff;
    --bg-card: #ffffff;
    --bg-soft: #eef6ff;
    --text-dark: #1a2a3a;
    --text-light: #6f7c87;

    /* Design system */
    --radius: 16px;
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 10px 28px rgba(0, 0, 0, 0.14);
}

/* ===========================================================
   CONTAINER
=========================================================== */
.ta-container {
    max-width: 1100px;
    margin: 2rem auto 3rem auto;
    padding: 0 1rem;
    font-family: 'Segoe UI', sans-serif;
    animation: fadeSlideIn 0.5s ease both;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================================================
   TITRE
=========================================================== */
#ta-title {
    color: var(--primary-light);
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* ===========================================================
   CARTES DE COUVERTURE (CNOPS / SANS)
=========================================================== */
.ta-insurance-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.ta-insurance-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid #dce7f7;
    transition: 0.35s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.ta-insurance-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-light);
}

.ta-insurance-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, var(--primary-light), var(--primary-hover));
    opacity: 0;
    transition: 0.35s ease;
    z-index: 0;
}

.ta-insurance-card:hover::before {
    opacity: 1;
}

.ta-card-content {
    position: relative;
    z-index: 2;
}

.ta-card-content h3 {
    font-size: 1.6rem;
    color: var(--primary);
    margin-bottom: 0.3rem;
}

.ta-card-content p {
    color: var(--text-light);
}

.ta-insurance-card:hover * {
    color: #ffffff !important;
}

/* ===========================================================
   CHAMP RECHERCHE
=========================================================== */
#ta-search {
    width: 100%;
    padding: 1rem;
    border-radius: var(--radius);
    border: 2px solid var(--primary-light);
    font-size: 1rem;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 10px rgba(18, 199, 232, 0.15);
}

#ta-search:focus {
    outline: none;
    border-color: var(--primary);
}

/* ===========================================================
   LISTE ANALYSES – PREMIUM + COMPACT
=========================================================== */
.ta-results-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.7rem;
    height: 50vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    border: 1px solid #e2eef8;
}

.ta-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-soft);
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius);
    border: 1px solid #d3e4f7;
    transition: 0.25s ease;
    margin-bottom: 0.8rem;
}

.ta-result:hover {
    background: #e9faff;
    border-color: var(--primary-light);
    transform: translateX(4px);
}

/* CODE + NOM */
.ta-result-code {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    margin-right: 12px;
}

.ta-result-name {
    font-size: 18px;
    color: var(--text-dark);
    font-weight: 500;
}

/* ===========================================================
   BOUTON AJOUTER – PREMIUM + ICÔNE + ANIMATION
=========================================================== */
.ta-add-btn {
    background: var(--primary-light);
    color: white;
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: 0.3s ease;
    margin-left: auto !important;
    box-shadow: 0 4px 10px rgba(18, 199, 232, 0.3);
}

.ta-add-btn::before {
    content: "+";
    font-size: 18px;
    font-weight: 700;
}

.ta-add-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(18, 199, 232, 0.45);
}

.ta-add-btn:active {
    transform: scale(0.92);
    transition: 0.1s;
}

/* ===========================================================
   PANIER – ANALYSES SÉLECTIONNÉES
=========================================================== */
.ta-basket-container {
    margin-top: 2.5rem;
    padding: 2rem;
    background: var(--secondary);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid #dce7f7;
}

.ta-basket-item {
    display: flex;
    background: #ffffff;
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid #e2eef8;
    margin-bottom: 1rem;
}

.ta-item-code {
    font-size: 15px;
    color: var(--primary);
    font-weight: 600;
    margin-right: 15px;
}

.ta-item-name {
    font-size: 18px;
    color: var(--text-dark);
}

/* Bouton X supprimé premium */
.ta-remove-btn {
    margin-left: auto;
    color: var(--primary);
    font-weight: 700;
    cursor: pointer;
    background: #eef6ff;
    border-radius: 10px;
    padding: 6px 10px;
    border: 1px solid #c8d9ea;
    transition: 0.3s ease;
}

.ta-remove-btn:hover {
    background: #d7edff;
    transform: scale(1.1);
}

/* ===========================================================
   TOTAL
=========================================================== */
.ta-total-card {
    font-size: 22px;
    font-weight: 700;
    text-align: right;
    color: var(--primary);
    margin-top: 1rem;
}

/* ===========================================================
   BOUTON "CHANGER DE COUVERTURE"
=========================================================== */
#ta-return {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--primary-light);
    color: white !important;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 10px rgba(18, 199, 232, 0.25);
    transition: 0.3s ease;
    margin-bottom: 1rem;
}

#ta-return::before {
    content: "←";
    font-size: 17px;
    font-weight: 700;
}

#ta-return:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(18, 199, 232, 0.45);
}

/* ===========================================================
   BOUTONS : RÉINITIALISER & IMPRIMER LE DEVIS
=========================================================== */
.ta-primary-btn,
.ta-secondary-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    transition: 0.3s ease;
}

/* Réinitialiser */
.ta-secondary-btn {
    background: #ef4a4a;
    color: white;
    box-shadow: 0 4px 12px rgba(239, 74, 74, 0.3);
}

.ta-secondary-btn::before {
    content: "↺";
    font-size: 17px;
    font-weight: 700;
}

.ta-secondary-btn:hover {
    background: #c73737;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(239, 74, 74, 0.4);
}

/* Imprimer */
.ta-primary-btn {
    background: var(--primary-light);
    color: white;
    box-shadow: 0 4px 12px rgba(18, 199, 232, 0.3);
}

.ta-primary-btn::before {
    content: "🖨️";
    font-size: 14px;
}

.ta-primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(18, 199, 232, 0.45);
}

/* ===========================================================
   NOTICE
=========================================================== */
.notice {
    text-align: center;
    margin-top: 1rem;
    color: var(--primary-light);
    font-size: 15px;
}

/* ===========================================================
   CARTE SÉLECTIONNÉE – FEEDBACK VISUEL
=========================================================== */
.ta-insurance-card.active-selected {
    border: 3px solid var(--primary-light);
    background: #e0faff;
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(18, 199, 232, 0.45);
}

/* Ensure text remains readable on selected card */
.ta-insurance-card.active-selected .ta-card-content h3 {
    color: var(--primary);
}

.ta-insurance-card.active-selected .ta-card-content p {
    color: var(--text-dark);
}

/* Override hover text color for selected card */
.ta-insurance-card.active-selected:hover * {
    color: #ffffff !important;
}

/* ===========================================================
   FIX MOBILE RESPONSIVE (تصحيح وضع الهاتف)
=========================================================== */
@media only screen and (max-width: 768px) {

    /* 1. تحسين الحاوية العامة لعدم الالتصاق بالحواف */
    .ta-container {
        padding: 0 15px !important;
        margin-top: 10px !important;
    }

    /* 2. جعل بطاقات التغطية تظهر واحدة تلو الأخرى */
    .ta-insurance-cards {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
        margin-top: 20px !important;
    }

    /* 3. إصلاح قائمة التحاليل (المشكلة الكبرى في الصورة) */
    .ta-result {
        flex-direction: column !important; /* ترتيب عمودي */
        align-items: flex-start !important;
        gap: 10px !important;
        padding: 15px !important;
    }

    .ta-result-name {
        font-size: 15px !important;
        margin-bottom: 5px !important;
        line-height: 1.4;
    }

    /* 4. زر "إضافة" يصبح عريضاً وسهل الضغط */
    .ta-add-btn {
        width: 100% !important;
        justify-content: center !important;
        margin-left: 0 !important;
        padding: 10px !important;
    }

    /* 5. إصلاح أزرار الطباعة وإعادة التعيين في الأسفل */
    .ta-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .ta-primary-btn, 
    .ta-secondary-btn {
        width: 100% !important;
        justify-content: center !important;
    }
    
    /* 6. تكبير زر الرجوع */
    #ta-return {
        width: 100%;
        justify-content: center;
        margin-bottom: 15px;
    }
}