/* 
 * Custom Admin CSS 
 * Add any future custom styles for the admin dashboard here.
 */

:root { --primary: #1E293B; }
body { font-family: 'Nunito', sans-serif; background-color: #f8f9fc; }
#wrapper { display: flex; }
#content-wrapper { width: 100%; overflow-x: hidden; }
.sidebar { width: 250px; min-height: 100vh; background: #1E293B; color: white; }
.sidebar .nav-item { padding: 15px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); cursor: pointer; transition: 0.3s; }
.sidebar .nav-item:hover { background: rgba(255,255,255,0.1); }
.sidebar .nav-item.active { background: rgba(255,255,255,0.2); font-weight: bold; }
.topbar { height: 70px; background: white; box-shadow: 0 .15rem 1.75rem 0 rgba(58,59,69,.15); display: flex; align-items: center; padding: 0 20px; margin-bottom: 25px; }
.card { border: none; border-radius: 0.35rem; box-shadow: 0 .15rem 1.75rem 0 rgba(58,59,69,.15); }
.card-header { background-color: #f8f9fc; border-bottom: 1px solid #e3e6f0; font-weight: bold; color: #1E293B; }

/* Override primary text and background colors */
.text-primary { color: #1E293B !important; }
.bg-primary { background-color: #1E293B !important; }

/* Override all buttons except danger/close to use #10B981 */
.btn:not(.btn-danger):not(.btn-outline-danger):not(.btn-close) {
    background-color: #10B981 !important;
    border-color: #10B981 !important;
    color: #ffffff !important;
}
.btn:not(.btn-danger):not(.btn-outline-danger):not(.btn-close):hover {
    background-color: #0ea171 !important;
    border-color: #0ea171 !important;
    color: #ffffff !important;
}

/* Custom styles for External Code badging and active chat items */
.ext-code-badge,
.user-item .ext-code-badge,
.support-item .ext-code-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: bold;
    color: #ffffff !important;
    display: inline-block;
    line-height: 1.2;
}
.ext-code-default { background-color: #0f172a !important; color: #ffffff !important; }
.ext-code-military { background-color: #1b4332 !important; color: #ffffff !important; }
.ext-code-bv { background-color: #18181b !important; color: #ffffff !important; }
.ext-code-other { background-color: #475569 !important; color: #ffffff !important; }

.user-item.active,
.support-item.active {
    background-color: #047857 !important;
    border-color: #047857 !important;
}
.user-item.active h6,
.user-item.active p,
.user-item.active .text-muted.chat-date,
.user-item.active .user-card-display,
.support-item.active h6,
.support-item.active p,
.support-item.active .text-muted {
    color: #ffffff !important;
}

/* Chat Layout Styles */
.chat-user-msg {
    max-width: 200px;
}
#chat-messages {
    height: 450px;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fc;
    border: 1px solid #eee;
    margin-bottom: 10px;
    border-radius: 5px;
}
#load-more-container, #close-chat-btn, #message-templates {
    display: none;
}
.msg-content-wrapper {
    max-width: 75%;
}
.msg-time {
    font-size: 0.7rem;
}

.sidebar-chat-list {
    max-height: 700px;
    overflow-y: auto;
}

/* --- Login Page Styles --- */
:root {
    --login-primary: #10B981;
    --login-primary-hover: #0ea171;
    --login-surface: rgba(30, 41, 59, 0.7);
    --login-surface-border: rgba(255, 255, 255, 0.1);
    --login-text-main: #f8fafc;
    --login-text-muted: #94a3b8;
    --login-error: #ef4444;
    --login-error-bg: rgba(239, 68, 68, 0.1);
}

.login-body {
    background-color: #ffffff !important;
    color: #1E293B !important;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    margin: 0;
}

.login-body * {
    box-sizing: border-box;
}

/* Animated Background Gradients */
.login-body .bg-shape {
    position: absolute;
    filter: blur(100px);
    border-radius: 50%;
    animation: float 20s infinite ease-in-out alternate;
    z-index: 0;
}

.login-body .shape1 {
    width: 400px;
    height: 400px;
    background: rgba(99, 102, 241, 0.3);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.login-body .shape2 {
    width: 500px;
    height: 500px;
    background: rgba(168, 85, 247, 0.2);
    bottom: -200px;
    right: -100px;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(50px, 50px) scale(1.1); }
    100% { transform: translate(-50px, 100px) scale(0.9); }
}

/* Glassmorphism Container */
.login-container {
    position: relative;
    z-index: 10;
    background: #1E293B !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--login-surface-border);
    padding: 3rem;
    border-radius: 1.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-header p {
    color: var(--login-text-muted);
    font-size: 0.95rem;
    font-weight: 300;
}

.login-form-group {
    margin-bottom: 1.5rem;
}

.login-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--login-text-muted);
    font-weight: 400;
}

.login-form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid var(--login-surface-border) !important;
    border-radius: 0.75rem;
    color: white !important;
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
}

.login-form-control:focus {
    border-color: var(--login-primary) !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    background: rgba(15, 23, 42, 0.8) !important;
}

.login-btn-submit {
    width: 100%;
    padding: 0.875rem;
    border: none;
    border-radius: 0.75rem;
    background: var(--login-primary) !important;
    color: white !important;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.login-btn-submit:hover {
    background: var(--login-primary-hover) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

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

.login-error-message {
    background: var(--login-error-bg);
    border-left: 4px solid var(--login-error);
    color: #fca5a5;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Subtle glowing dots in background */
.login-body .dots {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 24px 24px;
    z-index: 1;
}

/* Sidebar Chat Tabs styles */
.chat-tab-item {
    flex: 1;
}
.chat-tab-btn {
    font-size: 0.85rem;
    /* Eticheta și contorul rămân pe același rând, indiferent de lățime */
    white-space: nowrap;
}

/* Pe telefon coloana devine full-width, dar cele 4 tab-uri tot nu încap la
   dimensiunea normală, iar badge-ul cădea pe rândul următor. Micșorăm textul
   și contorul în loc să lăsăm rândul să se rupă. */
@media (max-width: 575.98px) {
    .chat-tab-btn {
        font-size: 0.7rem;
    }
    .chat-tab-btn .badge {
        font-size: 0.6rem;
        padding: 0.2em 0.4em;
    }
}

@media (max-width: 380px) {
    .chat-tab-btn {
        font-size: 0.62rem;
    }
    .chat-tab-btn .badge {
        font-size: 0.55rem;
        padding: 0.15em 0.35em;
        margin-left: 0.15rem !important;
    }
}

/* Sidebar Uman requests filtering */
.show-only-unassigned .user-item:not(.needs-operator-chat) {
    display: none !important;
}

.show-only-human .user-item:not(.assigned-operator-chat) {
    display: none !important;
}

.show-only-my-chats .user-item:not(.my-assigned-chat) {
    display: none !important;
}

/* Quick reply options styles */
.chat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    margin-top: 10px;
}

@keyframes chipFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chat-chip-btn {
    background: #ffffff;
    border: 1px solid rgb(38, 50, 56);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: rgb(38, 50, 56);
    transition: all 0.3s ease;
    animation: chipFadeIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.chat-chip-btn:hover {
    background: rgb(38, 50, 56);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(38, 50, 56, 0.2);
}

/* Chat points link style */
.chat-points-link {
    color: #000000;
    font-weight: bold;
    text-decoration: underline;
}

.msg-text {
    white-space: pre-wrap;
    word-break: break-word;
}

/* Premium Styling and Micro-animations for Support Settings */
.settings-card {
    background: #ffffff;
    border: none;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}
.settings-card:hover {
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.08);
}
.nav-pills .nav-link {
    color: #5a5c69;
    font-weight: 600;
    padding: 12px 20px;
    border-radius: 12px;
    transition: all 0.3s ease;
    margin-right: 8px;
}
.nav-pills .nav-link.active {
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(78, 115, 223, 0.35);
}
.nav-pills .nav-link:hover:not(.active) {
    background-color: #f8f9fc;
    color: #4e73df;
}
.section-title {
    font-weight: 700;
    color: #3a3b45;
    border-left: 4px solid #4e73df;
    padding-left: 12px;
    margin-bottom: 24px;
    margin-top: 10px;
}
.btn-premium-save {
    background: linear-gradient(135deg, #1cc88a 0%, #13855c 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 12px 30px !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 15px rgba(28, 200, 138, 0.3) !important;
    transition: all 0.2s ease !important;
}
.btn-premium-save:hover {
    background: linear-gradient(135deg, #17a673 0%, #117852 100%) !important;
    color: white !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 20px rgba(28, 200, 138, 0.4) !important;
}
.btn-premium-save:active {
    transform: translateY(0) !important;
}
.working-hours-row {
    background-color: #f8f9fc;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
    border: 1px solid #e3e6f0;
}
.working-hours-row:hover {
    border-color: #bac8f3;
    background-color: #f1f3f9;
}
.working-hours-row.disabled-row {
    opacity: 0.65;
    background-color: #f8f9fc;
    border-color: #e3e6f0;
}
.form-control, .form-select {
    border-radius: 10px;
    padding: 12px;
    border: 1px solid #d1d3e2;
    transition: all 0.2s ease;
}
.form-control:focus, .form-select:focus {
    border-color: #bac8f3;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.15);
}
.form-check-input {
    width: 1.3em;
    height: 1.3em;
    margin-top: 0.15em;
    cursor: pointer;
}
.badge-tab {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 0.8rem;
}
.nav-link:not(.active) .badge-tab {
    background: #eaecf4;
    color: #858796;
}

/* Operator Chat Reports Styles */
.support-item {
    border-left: 4px solid transparent;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}
.support-item:hover {
    background-color: #f1f5f9;
}
.support-item.status-closed {
    border-left-color: #10B981;
}
.support-item.status-open {
    border-left-color: #F59E0B;
}
.support-item.active {
    background-color: #047857 !important;
    border-color: #047857 !important;
    color: #ffffff !important;
}
.support-item.active h6,
.support-item.active p,
.support-item.active small,
.support-item.active .text-muted {
    color: #ffffff !important;
}
.support-item.active .badge-outline {
    border-color: #ffffff !important;
    color: #ffffff !important;
}
.show-only-closed .support-item:not(.status-closed) {
    display: none !important;
}
.show-only-open .support-item:not(.status-open) {
    display: none !important;
}
.date-filter-group {
    width: auto;
}
.chat-date-small {
    font-size: 0.72rem;
}
.chat-msg-count {
    font-size: 0.68rem;
}
.chat-footer-info {
    display: none;
}

/* Filtre (site / căutare) din paginile de listare */
.filter-group {
    width: auto;
}
.site-filter {
    flex: 0 0 200px;
}
.search-filter {
    flex: 0 0 260px;
}

/* ---------------------------------------------------------------------------
   Clase extrase din atribute style= din blade-uri.
   Regulă de proiect: fără CSS inline în blade — totul aici.
   --------------------------------------------------------------------------- */

/* Ascundere inițială. Nu folosim .d-none pentru elementele pe care JS le
   afișează cu .show()/.hide(), fiindcă .d-none are !important și le-ar bloca. */
.is-hidden {
    display: none;
}

/* Layout / sidebar */
.sidebar-section-heading {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
}

/* Tabele */
.table-head-sm {
    font-size: 0.8rem;
}

/* Fereastra de conversație din istoricul de chat */
.chat-history-window {
    height: 500px;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fc;
    border: 1px solid #eee;
    margin-bottom: 10px;
    border-radius: 5px;
}
.msg-bubble-narrow {
    max-width: 75%;
}
.msg-time-xs {
    font-size: 0.7rem;
}

/* Zona de compunere a răspunsului */
.textarea-no-resize {
    resize: none;
}

/* Grafice */
.chart-container.chart-container-lg {
    height: 350px;
}

/* Pagina de setări */
.alert-rounded {
    border-radius: 12px;
}
.store-card {
    border-radius: 12px;
    background-color: #ffffff;
}
.settings-text-sm {
    font-size: 0.85rem;
}
.settings-text-md {
    font-size: 0.9rem;
}
.settings-text-lg {
    font-size: 0.95rem;
}
.cursor-pointer {
    cursor: pointer;
}

/* Pagina de rapoarte (mutat din blocul <style> din blade) */
.kpi-card {
    border-left: 4px solid #1E293B;
    transition: transform 0.2s ease-in-out;
}
.kpi-card:hover {
    transform: translateY(-5px);
}
.kpi-conversations { border-left-color: #4e73df; }
.kpi-closed { border-left-color: #1cc88a; }
.kpi-open { border-left-color: #f6c23e; }
.kpi-avg-time { border-left-color: #36b9cc; }

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}
.agent-table th {
    background-color: #f8f9fc;
    color: #1E293B;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}
.agent-table td {
    vertical-align: middle;
}

/* ---------------------------------------------------------------------------
   Meniu lateral pliabil. Implicit este strâns (clasa .sidebar-collapsed pe body),
   ca zona de conținut să fie cât mai lată. Starea se ține în localStorage.
   --------------------------------------------------------------------------- */
.sidebar {
    transition: width 0.2s ease;
    overflow-x: hidden;
}

body.sidebar-collapsed .sidebar {
    width: 70px;
}
body.sidebar-collapsed .sidebar .sidebar-brand-text,
body.sidebar-collapsed .sidebar .sidebar-section-heading,
body.sidebar-collapsed .sidebar .nav-link span {
    display: none;
}
body.sidebar-collapsed .sidebar .sidebar-brand {
    padding: 1.25rem 0;
}
body.sidebar-collapsed .sidebar .sidebar-brand-icon {
    margin: 0;
}
body.sidebar-collapsed .sidebar .nav-item {
    padding: 15px 0;
    text-align: center;
}
body.sidebar-collapsed .sidebar .nav-link i {
    margin: 0;
}
/* Titlurile de secțiune dispar, dar păstrăm o mică respirație între grupuri */
body.sidebar-collapsed .sidebar .sidebar-section-heading + .nav-item {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Butonul de comutare din bara superioară. Fără clasa .btn, ca să nu intre sub
   regula globală care colorează toate butoanele în verde. */
.sidebar-toggle-btn {
    background: transparent;
    border: none;
    color: #1E293B;
    font-size: 1.15rem;
    line-height: 1;
    padding: 0.5rem 0.65rem;
    margin-right: 0.75rem;
    border-radius: 0.35rem;
    cursor: pointer;
}
.sidebar-toggle-btn:hover {
    background: #f1f5f9;
}
.sidebar-toggle-open {
    display: none;
}
.sidebar-toggle-close {
    display: inline-block;
}
body.sidebar-collapsed .sidebar-toggle-open {
    display: inline-block;
}
body.sidebar-collapsed .sidebar-toggle-close {
    display: none;
}

/* Titlul din bara superioară: compact și cu accent */
.topbar-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

/* Grafice cu derulare orizontală pe ecrane mici, ca la .table-responsive.
   Pe desktop nu se setează min-width, deci nu apare nicio bară de derulare. */
.chart-scroll {
    overflow-x: auto;
}
@media (max-width: 767.98px) {
    .chart-scroll .chart-container {
        min-width: 520px;
    }
}
/* Graficul pe ore are 24 de etichete, îi trebuie mai mult loc și pe tabletă */
@media (max-width: 991.98px) {
    .chart-scroll .chart-container.chart-container-lg {
        min-width: 760px;
    }
}
