/* ===================================================================
 * TEMA DE CULORI MOV - v4.0.5 (VERSIUNE FINALĂ CU CARDURI INDIVIDUALE)
 * Unifică toate stilurile anterioare cu noua temă de culori.
 * Paletă:
 * Mov Principal: #5E338D
 * Mov Deschis (Fundal): #f2e6ff
 * Accent Ștergere/Urgență: #ff1962
 * Roz Pal (Editare): #f4a9c8
 * =================================================================== */

/* ======== STILURI DE BAZĂ FORMULAR ======== */
.fcc-form {
    width: 100%;
    margin: 20px 0;
    padding: 25px;
    border: 2px solid #5E338D;
    border-radius: 5px;
    background: #fdfcff;
    box-sizing: border-box;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.fcc-field-group {
    margin-bottom: 15px;
}
.fcc-field-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}
.fcc-form input[type="text"],
.fcc-form input[type="email"],
.fcc-form input[type="number"],
.fcc-form input[type="date"],
.fcc-form input[type="datetime-local"],
.fcc-form textarea,
.fcc-account-settings select,
.fcc-setting-field input[type="text"] {
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
}
.fcc-form input:focus, .fcc-form textarea:focus, .fcc-account-settings select:focus, .fcc-setting-field input[type="text"]:focus {
    border-color: #5E338D;
    box-shadow: 0 0 0 1px #5E338D;
    outline: none;
}
.fcc-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.fcc-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ======== RÂNDURI PRODUSE FORMULAR ======== */
.fcc-line-item-row[data-template] { display: none; }
.fcc-line-item-header {
    display: flex; gap: 10px; margin-bottom: 5px; padding: 0 5px 5px; font-weight: bold;
    font-size: 12px; color: #555; border-bottom: 1px solid #ccc;
}
.fcc-line-item-row { display: flex; gap: 10px; margin-bottom: 10px; align-items: center; }
.fcc-item-desc { flex: 4; }
.fcc-item-qty { flex: 1; }
.fcc-item-price { flex: 1.5; }
.fcc-item-total { flex: 1.5; }
.fcc-item-action { flex: 1; text-align: center; }
.fcc-line-item-row input.fcc-item-total { background-color: #eee; border: 1px solid #ddd; }

/* ======== SECȚIUNEA DE TOTALURI FORMULAR ======== */
#fcc-totals-wrapper {
    max-width: 400px; margin-left: auto; margin-top: 20px; padding: 15px;
    background: #fdfcff; border: 1px solid #e0e0e0; border-radius: 4px;
}
.fcc-totals-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #eee; }
.fcc-totals-row:last-child { border-bottom: none; }
.fcc-totals-row label { font-weight: bold; color: #333; margin: 0; }
.fcc-totals-row #fcc-tva-rate { width: 60px; padding: 5px; text-align: right; }
.fcc-totals-row.fcc-grand-total label, .fcc-totals-row.fcc-grand-total span {
    font-weight: bold; font-size: 1.2em; color: #000;
}
.fcc-totals-row.fcc-grand-total { background-color: #f2e6ff; margin: 5px -15px 0; padding: 10px 15px; border-bottom: none; }

/* ======== BIFA TVA ======== */
.fcc-tva-toggle { background: #fdfdfd; padding: 10px 8px !important; border-bottom: 1px solid #e0e0e0 !important; }
.fcc-tva-toggle label { font-size: 13px; font-weight: normal; color: #555; cursor: pointer; }
#fcc-prices-include-tva { width: auto; margin-left: 10px; transform: scale(1.2); cursor: pointer; }

/* ======== BUTOANE ======== */
.fcc-button-primary, .fcc-button-secondary, .fcc-remove-row, .fcc-form-actions a, a.fcc-edit-sheet, button.fcc-delete-sheet, button.fcc-print-sheet, .fcc-delete-attachment {
    padding: 10px 15px; border-radius: 4px; cursor: pointer; text-transform: uppercase;
    font-size: 12px; font-weight: bold; border: none; text-decoration: none; line-height: 1.5;
    text-align: center; display: inline-block;
}
.fcc-form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.fcc-button-primary { background-color: #5E338D; color: white; }
.fcc-button-primary:hover { background-color: #4c2972; }
.fcc-button-primary:disabled { background-color: #999; }
.fcc-button-secondary, .fcc-form-actions a.fcc-button-secondary, #fcc-add-row, button.fcc-print-sheet {
    background-color: #f0f0f0; color: #333; border: 1px solid #ccc;
}
.fcc-button-secondary:hover, .fcc-form-actions a.fcc-button-secondary:hover, #fcc-add-row:hover, button.fcc-print-sheet:hover { background-color: #e0e0e0; }
.fcc-remove-row, .fcc-delete-attachment, button.fcc-delete-sheet { background-color: #ff1962; color: white; }
.fcc-remove-row:hover, .fcc-delete-attachment:hover, button.fcc-delete-sheet:hover { background-color: #d60045; }
a.fcc-edit-sheet { background-color: #f4a9c8; color: #333; }
a.fcc-edit-sheet:hover { background-color: #e892b6; color: #000; }

/* ======== ANTET [fcc_logo_header] ======== */
.fcc-form-header {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 20px;
    padding: 15px; background: #fdfcff; border: 1px solid #e0e0e0; border-radius: 4px; margin-bottom: 20px;
}
.fcc-header-brand { display: flex; align-items: center; gap: 20px; flex-grow: 1; }
.fcc-form-logo { max-height: 70px; max-width: 180px; height: auto; width: auto; }
.fcc-header-brand h3 { margin: 0; font-size: 24px; color: #5E338D; }
.fcc-header-storage { flex-basis: 400px; flex-shrink: 0; }
.fcc-header-storage:empty { display: none; }

/* ======== BARA DE STOCARE ======== */
.fcc-storage-quota-wrapper { display: flex; align-items: center; gap: 10px; }
.fcc-storage-quota-wrapper label { font-weight: normal; font-size: 12px; margin-bottom: 0; color: #555; flex-shrink: 0; flex-basis: 150px; }
.fcc-storage-bar { width: 100%; height: 10px; background: #eee; border-radius: 5px; overflow: hidden; border: 1px solid #ddd; flex-grow: 1; }
.fcc-storage-bar-inner { height: 100%; background: #5E338D; border-radius: 5px; transition: width 0.5s ease;
    background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
    background-size: 20px 20px;
}
.fcc-storage-label { text-align: right; font-size: 11px; color: #555; flex-shrink: 0; flex-basis: 120px; }

/* ======== TABEL ISTORIC - MODIFICAT PENTRU CARDURI (v4.0.6) ======== */
.fcc-history-table {
    width: 100%;
    margin-top: 20px;
    border-collapse: separate; /* Permite spațierea între carduri */
    border-spacing: 0 15px; /* Creează spațiu vertical între carduri */
}

.fcc-history-table th {
    background-color: #f2e6ff;
    border: 1px solid #4a0e81;
    padding: 10px;
    text-align: left;
}
.fcc-history-table th:first-child {
    border-top-left-radius: 5px;
}

.fcc-history-table th:last-child {
    border-top-right-radius: 5px;
}

/* NOU: Metodă modernă și curată pentru carduri pe PC */
.fcc-history-table tr.fcc-main-row {
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    box-shadow: 0 0 0 2px #5E338D;
    outline: none;
}
/* NOU: Când cardul este deschis, eliminăm chenarul de jos */
.fcc-history-table tr.fcc-main-row.fcc-details-open {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: 2px 0 0 0 #5E338D,  /* Chenar stânga */
                -2px 0 0 0 #5E338D, /* Chenar dreapta */
                0 -2px 0 0 #5E338D; /* Chenar sus */
}
.fcc-history-table tr.fcc-main-row td {
    padding: 12px 10px;
    text-align: left;
    vertical-align: middle;
    background: #fff; /* Asigurăm fundalul alb */
    
}

/* Rotunjim colțurile corect */
.fcc-history-table tr.fcc-main-row td:first-child {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}
.fcc-history-table tr.fcc-main-row td:last-child {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* Păstrăm stilurile specifice pentru celule */
/* NOU: Stil pentru celule cu fundal alternant pe orizontală */
.fcc-history-table tr.fcc-main-row td:nth-child(even) {
    background: #f2e6ff; /* Culoarea lila deschis */
}
.fcc-details-row td {
    background-color: #fdfcff;
    padding: 20px;
    /* Construim chenarul corect, de 2px, mov închis */
    border-left: 2px solid #5E338D;
    border-right: 2px solid #5E338D;
    border-bottom: 2px solid #5E338D;
    border-top: none; /* Fără chenar sus, pentru a evita linia dublă */
    /* Rotunjim doar colțurile de jos */
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
    box-shadow: inset 0 4px 8px -4px rgba(0,0,0,0.05);
     margin-top: -15px; /* NOU: Anulează spațiul dintre carduri */
}
.fcc-history-table tr.fcc-main-row td.fcc-highlighted-date {
    font-weight: bold;
    font-size: 1.05em;
    color: #1a202c;
   
}
.fcc-history-table tr.fcc-main-row td.fcc-days-remaining {
    font-weight: bold;
    color: #5E338D;
    background: #f2e6ff;
    text-align: center;
}
.fcc-history-table td.fcc-days-remaining strong {
    color: #ff1962;
    font-size: 1.1em;
}
.fcc-history-table .fcc-actions-col {
    width: 220px;
    text-align: center;
}
.fcc-history-table .fcc-actions-col button, .fcc-history-table .fcc-actions-col a {
    padding: 6px 10px;
    font-size: 11px;
    margin: 2px;
    width: 45%;
    box-sizing: border-box;
}
.fcc-notification-indicator {
    font-size: 14px;
    font-weight: bold;
    margin-right: 8px;
    vertical-align: middle;
    cursor: help;
}
.fcc-notification-indicator.fcc-sent { color: #28a745; }
.fcc-notification-indicator.fcc-pending { color: #adb5bd; font-size: 10px; }

/* ======== DETALII ÎN ISTORIC (PRODUSE, ATAȘAMENTE) ======== */
.fcc-details-products { list-style: none; padding-left: 0; border-top: 1px solid #eee; margin-top: 10px; }
.fcc-details-products li { display: flex; justify-content: space-between; padding: 8px 5px; border-bottom: 1px solid #eee; }
.fcc-details-products li.fcc-details-totals { justify-content: flex-end; gap: 20px; background: #f9f9f9; font-weight: bold; }
.fcc-details-products li.fcc-grand-total { font-size: 1.1em; background: #f0f0f0; }
.fcc-details-pricing-note { font-size: 12px; color: #555; margin: 5px 0 10px 0; padding-bottom: 5px; border-bottom: 1px dashed #eee; }
.fcc-details-attachment-list { list-style: none; margin-left: 0; padding-left: 0; }
.fcc-details-attachment-list li a { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: bold; }
.fcc-details-attachment-preview { max-width: 100px; max-height: 70px; border: 1px solid #ddd; border-radius: 3px; padding: 2px; background: #fff; }

/* ======== GESTIONARE ATAȘAMENTE (LA EDITARE) ======== */
#fcc-existing-attachments { background: #fdfdfd; border: 1px solid #eee; padding: 15px; margin-bottom: 20px; border-radius: 4px; }
#fcc-existing-attachments h4 { margin: 0 0 10px; font-size: 14px; color: #333; }
#fcc-attachment-list { list-style: none; margin: 0; padding: 0; }
#fcc-attachment-list li { display: flex; justify-content: space-between; align-items: center; padding: 8px; border-bottom: 1px solid #f0f0f0; }
#fcc-attachment-list li:last-child { border-bottom: none; }
#fcc-attachment-list li a { font-weight: bold; text-decoration: none; word-break: break-all; padding-right: 15px; }

/* ======== SETĂRI CONT ======== */
.fcc-account-settings { border: 1px solid #ddd; padding: 20px; margin-top: 30px; border-radius: 4px; background: #f9f9f9; }
.fcc-setting-field { margin-bottom: 15px; }
.fcc-setting-field input[type="text"] { max-width: 400px; }
.fcc-logo-preview { margin-top: 10px; padding: 10px; background: #fff; border: 1px dashed #ccc; display: inline-block; }
.fcc-logo-preview img { max-width: 200px; max-height: 80px; display: block; margin-bottom: 10px; }

/* ======== CALENDARE (STILURI UNIFICATE) ======== */
.fcc-calendar-wrapper { border: 2px solid #5E338D; padding: 15px; margin: 20px auto; background: #fff; border-radius: 4px; }
.fcc-calendar-header { text-align: center; margin-bottom: 15px; }
.fcc-calendar-header h3 { margin: 0; font-size: 20px; color: #5E338D; }
.fcc-calendar { width: 100%; border-collapse: collapse; }
.fcc-calendar th { padding: 10px 5px; background: #f7fafc; font-weight: bold; color: #555; }
.fcc-calendar td { width: 14.28%; border: 1px solid #f2e6ff; padding: 5px; vertical-align: top; }
.fcc-calendar td.today { background-color: #f2e6ff; font-weight: bold; }
.fcc-calendar td.has-events { background-color: #f2e6ff; cursor: pointer; font-weight: bold; border: 1px solid #d9b8ff; }
.fcc-calendar td.has-events a { display: block; text-decoration: none; color: #ff1962; font-weight: bold; padding: 2px; }
.fcc-calendar td.has-events a:hover { background-color: #ff1962; color: #fff; border-radius: 3px; }
.fcc-calendar-wrapper:not(.fcc-calendar-small) .fcc-calendar td { height: 80px; text-align: center; }
.fcc-calendar-tooltip { display: block; position: absolute; top: calc(100% + 5px); left: 0; background: #5E338D; color: #fff; padding: 10px; border-radius: 4px; z-index: 1000; max-width: 250px; font-size: 13px; line-height: 1.5; pointer-events: none; }
.fcc-calendar-wrapper .fcc-calendar .month-separator { text-align: center; font-weight: bold; background-color: #f2e6ff; color: #5E338D; padding: 10px; font-size: 1.1em; border: none; }

/* ======== CALENDAR MIC (WIDGET) ======== */
.widget .fcc-calendar-wrapper.fcc-calendar-small { padding: 0; border-width: 1px; }
.fcc-calendar-wrapper.fcc-calendar-small .fcc-calendar-header h3 { font-size: 1em; text-align: center; margin-bottom: 10px; color: #555; padding: 10px 10px 0; }
.fcc-calendar-wrapper.fcc-calendar-small .fcc-calendar { font-size: 13px; border: none; }
.fcc-calendar-wrapper.fcc-calendar-small .fcc-calendar th { background: transparent; padding: 8px 0; border-bottom: 1px solid #eee; border-left: none; border-right: none; }
.fcc-calendar-wrapper.fcc-calendar-small .fcc-calendar td { height: auto; padding: 4px; text-align: center; }
.fcc-calendar-wrapper.fcc-calendar-small .month-separator { font-size: 0.9em; padding: 6px; }

/* ======== MESAJE, LOADER, NOTIFICĂRI ======== */
#fcc-form-feedback { margin-top: 15px; padding: 10px; border-radius: 4px; }
.fcc-success { background-color: #dff0d8; border: 1px solid #d6e9c6; color: #3c763d; }
.fcc-error { background-color: #f2dede; border: 1px solid #ebccd1; color: #a94442; }
#fcc-page-loader { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(255, 255, 255, 0.85); z-index: 99998; display: flex; align-items: center; justify-content: center; transition: opacity 0.3s ease-out; }
.fcc-spinner { width: 50px; height: 50px; border: 5px solid #e0e0e0; border-top-color: #5E338D; border-radius: 50%; animation: fcc-spin 1s linear infinite; }
@keyframes fcc-spin { to { transform: rotate(360deg); } }
.fcc-toast-notification { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); padding: 16px 24px; border-radius: 8px; font-size: 16px; font-weight: bold; color: white; z-index: 99999; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); opacity: 1; transition: opacity 0.5s ease-out; }
.fcc-toast-notification.fcc-success { background-color: #3c763d; }
.fcc-toast-notification.fcc-error { background-color: #a94442; }
.fcc-toast-notification.fcc-toast-fade-out { opacity: 0; }

/* ======== STILURI DE IMPRIMARE (PENTRU PDF) ======== */
@media print {
    .fcc-print-container { width: 100%; margin: 0 auto; }
    .fcc-print-container h1 { font-size: 19px; color: #1a202c; border-bottom: 2px solid #5E338D; padding-bottom: 8px; margin-top: 0; }
    .fcc-print-container h2 { font-size: 16px; color: #5E338D; border-bottom: 1px solid #eee; padding-bottom: 5px; margin-top: 25px; page-break-after: avoid; }
    .fcc-print-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
    .fcc-print-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
    .fcc-print-section { margin-bottom: 15px; page-break-inside: avoid; }
    .fcc-print-section strong { display: block; font-size: 11px; color: #718096; text-transform: uppercase; margin-bottom: 3px; }
    .fcc-print-section p { margin: 0; font-size: 13px; color: #2D3748; }
    .fcc-print-section.fcc-highlight-print p { font-weight: bold; background: #f7f7f7; padding: 5px 8px; }
    .fcc-print-products { width: 100%; border-collapse: collapse; margin-top: 15px; }
    .fcc-print-products th, .fcc-print-products td { border: 1px solid #ddd; padding: 8px; text-align: left; font-size: 12px; }
    .fcc-print-products th { background-color: #f7fafc; }
    .fcc-print-products .align-right { text-align: right; }
    .fcc-print-totals { width: 300px; margin-left: auto; margin-top: 15px; page-break-inside: avoid; }
    .fcc-print-totals tr td { border: 1px solid #ddd; padding: 8px; }
    .fcc-print-totals tr.fcc-grand-total td { font-size: 14px; background: #f2e6ff; }
    .fcc-print-header, .fcc-print-footer { display: none; /* Handled by PDF generation library */ }
}

/* ======== FIX TEMA KADENCE ======== */
.fcc-account-settings select#fcc_user_timezone, .fcc-account-settings select[name="fcc_user_timezone"] {
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M5%208l5%205%205-5z%22%20fill%3D%22%23555%22/%3E%3C/svg%3E') !important;
    background-repeat: no-repeat !important; background-position: right .7em top 50% !important; background-size: 1.2em auto !important;
    -webkit-appearance: none !important; -moz-appearance: none !important; appearance: none !important;
    max-width: 400px; padding-right: 30px !important;
}
/* Stil pentru a face textul din coloana Subiect bold */
.fcc-history-table td[data-label="Subiect"] {
    font-weight: bold;
}

/* ======== RESPONSIVE (MOBIL) ======== */
@media (max-width: 768px) {
    .fcc-grid-2, .fcc-grid-3 { grid-template-columns: 1fr; gap: 0; }

    /* --- Formular --- */
    .fcc-form-header { flex-direction: column; align-items: flex-start; }
    .fcc-header-storage, .fcc-storage-quota-wrapper { flex-basis: 100%; width: 100%; flex-wrap: wrap; }
    .fcc-line-item-header { display: none; }
    .fcc-line-item-row { flex-wrap: wrap; border-bottom: 1px solid #ddd; padding-bottom: 10px; }
    .fcc-line-item-row .fcc-item-desc { flex-basis: 100%; margin-bottom: 5px; }
    .fcc-line-item-row .fcc-item-action { flex-basis: 100%; margin-top: 10px; }
    #fcc-totals-wrapper { max-width: 100%; margin-left: 0; }

    /* --- Tabel Istoric (Metoda Flexbox - Robustă și Corectată) --- */
    .fcc-history-table thead { display: none; }
    .fcc-history-table tr.fcc-main-row {
        display: block;
        margin-bottom: 15px; /* Spațiul dintre carduri pe mobil */
        border: 2px solid #5E338D; /* Chenarul mov închis */
        border-radius: 5px; /* Colțuri rotunjite */
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        background: #fff;
    }
        .fcc-history-table tr.fcc-main-row.fcc-details-open {
        border-bottom: none;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        margin-bottom: 0;
    }
    .fcc-history-table tr.fcc-details-row { display: table-row; }
    .fcc-history-table tr.fcc-details-row[style*="display: none;"] { display: none !important; }

    .fcc-history-table tr.fcc-main-row td {
        display: flex; /* NOU: Folosim Flexbox pentru layout */
        align-items: flex-start; /* Aliniem la început (sus) pentru text pe mai multe rânduri */
        gap: 15px; /* Spațiu între etichetă și valoare */
        width: 100%;
        padding: 10px 15px !important;
        border-bottom: 1px solid #eee;
        line-height: 1.4;
    }
    .fcc-history-table tr.fcc-main-row td:last-child { border-bottom: none; }

    .fcc-history-table tr.fcc-main-row td:before {
        content: attr(data-label);
        font-weight: bold;
        color: #333;
        flex: 0 0 110px; /* NOU: Lățime fixă de 110px, nu se micșorează, nu crește */
    }

    /* Cazul special pentru coloana de acțiuni */
    .fcc-history-table tr.fcc-main-row td.fcc-actions-col {
        display: block; /* Suprascriem flex, nu avem nevoie de etichetă/valoare */
        padding: 8px 15px !important;
        background: #f9f9f9;
        text-align: center;
    }
    .fcc-history-table tr.fcc-main-row td.fcc-actions-col:before {
        display: none; /* Ascundem eticheta "Acțiuni" */
    }
    .fcc-history-table .fcc-actions-col a,
    .fcc-history-table .fcc-actions-col button {
        width: 48%;
        margin: 2px 1%;
    }

    /* --- Calendar --- */
    .fcc-calendar-wrapper { padding: 10px; }
    .fcc-calendar-header h3 { font-size: 1.2em; }
    .fcc-calendar th { padding: 8px 2px; font-size: 12px; }
    .fcc-calendar td { padding: 5px 2px; font-size: 13px; }
    .fcc-calendar-wrapper:not(.fcc-calendar-small) .fcc-calendar td { height: 60px; }
    .fcc-calendar .month-separator { font-size: 1em; padding: 8px; }
    .fcc-calendar-wrapper.fcc-calendar-small .fcc-calendar td { padding: 3px; line-height: 1.8; }
}