/* ============================================
   Tabler Custom CSS - Override-uri pentru ERP
   ============================================ */

/* Variabile CSS pentru layout ERP */
:root {
    --tblr-sidebar-width: 240px;
    --tblr-header-height: 60px;
    --tblr-content-max-width: 1400px;
    --tblr-content-padding-x: 1.5rem;
    --tblr-content-padding-y: 1rem;
    
    /* Colors - Tabler inspired */
    --tblr-primary: #206bc4;
    --tblr-success: #2fb344;
    --tblr-danger: #d63384;
    --tblr-warning: #f59f00;
    --tblr-info: #17a2b8;
    
    /* Background colors */
    --tblr-body-bg: #f8f9fa;
    --tblr-card-bg: #ffffff;
    --tblr-sidebar-bg: #ffffff;
    
    /* Text colors */
    --tblr-text-primary: #1f2937;
    --tblr-text-secondary: #6b7280;
    --tblr-text-muted: #9ca3af;
    
    /* Border colors */
    --tblr-border-color: #e5e7eb;
    --tblr-border-color-light: #f3f4f6;
    
    /* Spacing */
    --tblr-spacing-xs: 0.25rem;
    --tblr-spacing-sm: 0.5rem;
    --tblr-spacing-md: 1rem;
    --tblr-spacing-lg: 1.5rem;
    --tblr-spacing-xl: 2rem;
}

/* Compatibilitate cu Bootstrap - păstrăm clasele Bootstrap existente */
/* Tabler și Bootstrap pot coexista fără probleme majore */

/* Override-uri pentru a preveni conflicte */
.tabler-only {
    /* Clase care vor fi folosite doar cu Tabler */
}

/* Compatibilitate icons - păstrăm Bootstrap Icons și adăugăm Tabler Icons */
/* Putem folosi ambele: <i class="bi bi-..."></i> și <i class="ti ti-..."></i> */

/* Custom styles pentru ERP - vor fi folosite în Faza 2+ */
/* Acum doar definim variabilele, implementarea va veni în fazele următoare */

/* ============================================
   Faza 2: Layout Base - Sidebar + Header
   ============================================ */

/* Sidebar Fixă */
.sidebar-tabler {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--tblr-sidebar-width);
    height: 100vh;
    background: var(--tblr-sidebar-bg);
    border-right: 1px solid var(--tblr-border-color);
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-tabler-header {
    padding: 5px;
    border-bottom: 1px solid var(--tblr-border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-tabler-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: var(--tblr-text-primary);
}

.sidebar-tabler-nav {
    padding: 0.5rem 0;
}

.sidebar-tabler-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-tabler-nav li {
    padding: 0.25rem 0.5rem;
}

.sidebar-tabler-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    color: var(--tblr-text-secondary);
    text-decoration: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.sidebar-tabler-nav a:hover {
    background: #f3f4f6;
    color: var(--tblr-text-primary);
}

.sidebar-tabler-nav a.active {
    background: #e7f5ff;
    color: var(--tblr-primary);
    font-weight: 600;
}

.sidebar-tabler-nav a i {
    width: 20px;
    text-align: center;
    font-size: 1.125rem;
}

/* Submenu pentru dropdown-uri */
.sidebar-tabler-nav .submenu {
    padding-left: 2.5rem;
    margin-top: 0.25rem;
}

.sidebar-tabler-nav .submenu a {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-tabler-nav .submenu a i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

/* Header Compact - FĂRĂ MARGINI EXCESIVE */
.header-tabler {
    position: sticky;
    top: 0;
    height: var(--tblr-header-height);
    background: #fff;
    border-bottom: 1px solid var(--tblr-border-color);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem; /* Redus de la 1.5rem */
    margin-left: var(--tblr-sidebar-width);
}

.header-tabler-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-tabler-title {
    font-size: 1rem; /* Redus de la 1.125rem */
    font-weight: 600;
    color: var(--tblr-text-primary);
    margin: 0;
    line-height: 1.2;
}

.header-tabler-breadcrumbs {
    font-size: 0.75rem;
    color: var(--tblr-text-muted);
    margin-top: 0.25rem;
}

.header-tabler-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

/* Dropdown în header - z-index mai mare */
.header-tabler-right .dropdown-menu {
    z-index: 1050 !important;
}

/* Avatar styling pentru header */
.header-tabler-right .avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
}

.header-tabler-right .avatar-sm {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.75rem;
}

.header-tabler-right .nav-link {
    color: var(--tblr-text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.header-tabler-right .nav-link:hover {
    color: var(--tblr-text-primary);
}

/* Main Content Area - FĂRĂ MARGINI, UTILIZARE MAXIMĂ SPAȚIU */
.page-wrapper {
    margin-left: var(--tblr-sidebar-width);
    min-height: 100vh;
    background: var(--tblr-body-bg);
}

.page-content {
    padding: 0.75rem 1rem; /* Redus drastic - doar minim necesar */
    max-width: 100%; /* FĂRĂ limitare - folosim tot spațiul */
    margin: 0; /* FĂRĂ margin auto - ocupăm tot */
    width: 100%;
}

/* Buton hamburger pentru mobile */
.sidebar-mobile-toggle {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--tblr-text-primary);
    font-size: 1.25rem;
    display: none;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}

.sidebar-mobile-toggle:hover {
    background-color: #f3f4f6;
}

.sidebar-mobile-toggle i {
    font-size: 1.25rem;
}

/* Overlay pentru mobile când sidebar-ul este deschis */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* Responsive - Mobile */
@media (max-width: 767.98px) {
    .sidebar-tabler {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }
    
    .sidebar-tabler.show {
        transform: translateX(0);
    }
    
    .header-tabler {
        margin-left: 0;
    }
    
    .page-wrapper {
        margin-left: 0;
    }
    
    .page-content {
        padding: 0.75rem 1rem;
    }
    
    .sidebar-mobile-toggle {
        display: flex;
    }
}

@media (min-width: 768px) {
    .sidebar-mobile-toggle {
        display: none;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
}

/* Compatibilitate cu designul actual - păstrăm clasele existente */
.main-content-wrapper {
    margin-left: var(--tblr-sidebar-width);
}

/* Body background */
body {
    background-color: var(--tblr-body-bg);
}

/* Footer styling - COMPACT */
footer {
    margin-left: var(--tblr-sidebar-width);
    background: #fff;
    border-top: 1px solid var(--tblr-border-color);
    padding: 0.5rem 1rem; /* Redus de la 1rem 1.5rem */
    font-size: 0.75rem;
    color: var(--tblr-text-muted);
}

/* Override pentru a preveni conflicte cu Bootstrap */
.navbar {
    display: none !important; /* Ascundem navbar-ul Bootstrap vechi */
}

/* Sidebar Dropdown Toggle */
.sidebar-dropdown-toggle {
    cursor: pointer;
}

.sidebar-dropdown-toggle .ti-chevron-down {
    transition: transform 0.2s;
}

.sidebar-dropdown-toggle.active .ti-chevron-down {
    transform: rotate(180deg);
}

/* JavaScript pentru sidebar dropdowns */
.sidebar-tabler-nav .submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.sidebar-tabler-nav .submenu.show {
    max-height: 500px;
    display: block !important;
}

/* Active state pentru submenu items */
.sidebar-tabler-nav .submenu a.active {
    background: #e7f5ff;
    color: var(--tblr-primary);
    font-weight: 600;
}

/* ============================================
   FAZA 5: COMPONENTE REUTILIZABILE STANDARDIZATE
   ============================================ */

/* ============================================
   CARDS - Standardizate
   ============================================ */

/* Card Base - Compact */
.card {
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid var(--tblr-border-color);
    margin-bottom: 0.75rem;
    background: var(--tblr-card-bg);
}

/* Card Header - Compact */
.card-header {
    padding: 0.5rem 1rem;
    background: #f9fafb;
    border-bottom: 1px solid var(--tblr-border-color);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--tblr-text-primary);
}

.card-header i {
    margin-right: 0.5rem;
    color: var(--tblr-primary);
}

/* Card Body - Compact */
.card-body {
    padding: 0.75rem 1rem;
}

/* Card Footer - Compact */
.card-footer {
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border-top: 1px solid var(--tblr-border-color);
    font-size: 0.75rem;
}

/* Card Variants */
.card-bordered {
    border: 1px solid var(--tblr-border-color);
    box-shadow: none;
}

.card-shadow {
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ============================================
   TABLES - Standardizate Dense
   ============================================ */

/* Table Base - Compact */
.table {
    font-size: 0.875rem;
    margin: 0;
    width: 100%;
}

/* Table Header - Compact */
.table thead th {
    background: #f9fafb;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid var(--tblr-border-color);
    color: #6b7280;
    vertical-align: middle;
}

/* Table Body - Compact */
.table tbody td {
    padding: 0.5rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #f3f4f6;
    color: var(--tblr-text-primary);
}

/* Table Row Hover */
.table tbody tr:hover {
    background: #f9fafb;
}

/* Table Variants */
.table-vcenter td,
.table-vcenter th {
    vertical-align: middle;
}

.table-sm {
    font-size: 0.8125rem;
}

.table-sm thead th {
    font-size: 0.7rem;
    padding: 0.375rem 0.5rem;
}

.table-sm tbody td {
    padding: 0.375rem 0.5rem;
}

/* Table Bordered */
.table-bordered {
    border: 1px solid var(--tblr-border-color);
}

.table-bordered th,
.table-bordered td {
    border: 1px solid var(--tblr-border-color);
}

/* ============================================
   FORMS - Standardizate Compact
   ============================================ */

/* Form Label - Compact */
.form-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 0.25rem;
    display: block;
}

.form-label i {
    margin-right: 0.25rem;
}

/* Form Control - Compact */
.form-control,
.form-select {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--tblr-border-color);
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--tblr-primary);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(32, 107, 196, 0.25);
}

/* Form Control Small - Extra Compact */
.form-control-sm,
.form-select-sm {
    font-size: 0.8125rem;
    padding: 0.25rem 0.5rem;
}

/* Form Control Plaintext */
.form-control-plaintext {
    font-size: 0.875rem;
    color: var(--tblr-text-primary);
    padding: 0.375rem 0;
}

/* Form Validation States */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #dc2626;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc2626'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 3.6 .4.4.4-.4m0 4.8-.4-.4-.4.4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

.form-control.is-valid,
.form-select.is-valid {
    border-color: #10b981;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2310b981' d='m2.3 6.73.98-.98-.98-.98-.98.98.98.98zm1.98-1.98L6.27 6.73l.98-.98-1.99-1.98-.98.98z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

/* Form Error Message */
.invalid-feedback,
.text-danger {
    font-size: 0.75rem;
    color: #dc2626;
    margin-top: 0.25rem;
}

/* ============================================
   BUTTONS - Standardizate Compact
   ============================================ */

/* Button Base - Compact */
.btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    border: 1px solid transparent;
    cursor: pointer;
}

.btn i {
    font-size: 0.875rem;
    line-height: 1;
}

/* Button Small - Extra Compact */
.btn-sm {
    font-size: 0.8125rem;
    padding: 0.25rem 0.5rem;
}

.btn-sm i {
    font-size: 0.8125rem;
}

/* Button Icon Only - Square */
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon i {
    margin: 0;
}

/* Button Variants */
.btn-primary {
    background-color: var(--tblr-primary);
    border-color: var(--tblr-primary);
    color: #fff;
}

.btn-primary:hover {
    background-color: #1a5a9e;
    border-color: #1a5a9e;
    color: #fff;
}

.btn-secondary {
    background-color: #6b7280;
    border-color: #6b7280;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #4b5563;
    border-color: #4b5563;
    color: #fff;
}

.btn-success {
    background-color: var(--tblr-success);
    border-color: var(--tblr-success);
    color: #fff;
}

.btn-danger {
    background-color: var(--tblr-danger);
    border-color: var(--tblr-danger);
    color: #fff;
}

.btn-outline-primary {
    color: var(--tblr-primary);
    border-color: var(--tblr-primary);
    background-color: transparent;
}

.btn-outline-primary:hover {
    color: #fff;
    background-color: var(--tblr-primary);
    border-color: var(--tblr-primary);
}

.btn-outline-secondary {
    color: #6b7280;
    border-color: #6b7280;
    background-color: transparent;
}

.btn-outline-secondary:hover {
    color: #fff;
    background-color: #6b7280;
    border-color: #6b7280;
}

.btn-outline-danger {
    color: var(--tblr-danger);
    border-color: var(--tblr-danger);
    background-color: transparent;
}

.btn-outline-danger:hover {
    color: #fff;
    background-color: var(--tblr-danger);
    border-color: var(--tblr-danger);
}

.btn-outline-info {
    color: var(--tblr-info);
    border-color: var(--tblr-info);
    background-color: transparent;
}

.btn-outline-info:hover {
    color: #fff;
    background-color: var(--tblr-info);
    border-color: var(--tblr-info);
}

/* Button Disabled */
.btn:disabled,
.btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================
   BADGES - Standardizate
   ============================================ */

/* Badge Base */
.badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    font-weight: 500;
    border-radius: 0.375rem;
    line-height: 1;
}

/* Badge Variants - Status */
.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

.badge-processed {
    background: #dbeafe;
    color: #1e40af;
}

.badge-converted {
    background: #d1fae5;
    color: #065f46;
}

.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

/* Badge Variants - Colors */
.badge-primary {
    background-color: var(--tblr-primary);
    color: #fff;
}

.badge-success {
    background-color: var(--tblr-success);
    color: #fff;
}

.badge-danger {
    background-color: var(--tblr-danger);
    color: #fff;
}

.badge-warning {
    background-color: var(--tblr-warning);
    color: #fff;
}

.badge-info {
    background-color: var(--tblr-info);
    color: #fff;
}

/* Badge Small */
.badge-sm {
    font-size: 0.6875rem;
    padding: 0.1875rem 0.375rem;
}

/* ============================================
   ALERTS - Standardizate Compact
   ============================================ */

.alert {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    border: 1px solid transparent;
    margin-bottom: 0.75rem;
}

.alert-danger {
    background-color: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert-warning {
    background-color: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

.alert-success {
    background-color: #d1fae5;
    border-color: #a7f3d0;
    color: #065f46;
}

.alert-info {
    background-color: #dbeafe;
    border-color: #bfdbfe;
    color: #1e40af;
}

.alert i {
    margin-right: 0.5rem;
}

/* ============================================
   UTILITY CLASSES - Compact Spacing
   ============================================ */

/* Margin Bottom */
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 0.75rem !important; }
.mb-4 { margin-bottom: 1rem !important; }

/* Margin Top */
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 0.75rem !important; }
.mt-4 { margin-top: 1rem !important; }

/* Padding */
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 0.75rem !important; }
.p-4 { padding: 1rem !important; }

/* Text Alignment */
.text-end { text-align: right !important; }
.text-center { text-align: center !important; }
.text-start { text-align: left !important; }

/* Text Colors */
.text-muted { color: var(--tblr-text-muted) !important; }
.text-primary { color: var(--tblr-primary) !important; }
.text-danger { color: #dc2626 !important; }
.text-success { color: var(--tblr-success) !important; }

/* ============================================
   OPTIMIZARE: ELIMINARE MARGINI/PADDING EXCESIVE
   ============================================ */

/* Container-fluid - FĂRĂ padding excesiv */
.container-fluid {
    padding-left: 0.75rem !important; /* Redus de la 15px */
    padding-right: 0.75rem !important;
}

/* Row - FĂRĂ margin excesiv */
.row {
    margin-left: -0.375rem !important; /* Redus de la -15px */
    margin-right: -0.375rem !important;
}

.row > * {
    padding-left: 0.375rem !important; /* Redus de la 15px */
    padding-right: 0.375rem !important;
}

/* Cards - COMPACT */
.card {
    margin-bottom: 0.75rem !important; /* Redus de la 1.5rem */
}

.card-body {
    padding: 0.75rem 1rem !important; /* Redus de la 1.25rem 1.5rem */
}

.card-header {
    padding: 0.5rem 1rem !important; /* Redus de la 1rem 1.5rem */
}

/* Dashboard specific - ELIMINARE padding excesiv */
.dashboard-wrapper {
    padding: 0.5rem 0 !important; /* Redus de la 1.5rem 0 */
}

/* Stat cards - COMPACT */
.stat-card .card-body {
    padding: 0.75rem 1rem !important; /* Redus de la 1.25rem */
}

/* Chart cards - COMPACT */
.chart-card .card-header {
    padding: 0.75rem 1rem !important; /* Redus de la 1.25rem 1.5rem */
}

.chart-card .card-body {
    padding: 1rem !important; /* Redus de la 1.5rem */
}

/* Dashboard sections - COMPACT */
.dashboard-section .card-header {
    padding: 0.75rem 1rem !important; /* Redus de la 1rem 1.5rem */
}

/* Tables - COMPACT */
.table {
    margin-bottom: 0.5rem !important;
}

.table td, .table th {
    padding: 0.5rem 0.75rem !important; /* Redus de la 0.75rem 1rem */
}

/* Buttons - COMPACT */
.btn {
    padding: 0.375rem 0.75rem !important; /* Redus de la 0.5rem 1rem */
    font-size: 0.875rem !important;
}

.btn-sm {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.8125rem !important;
}

/* Forms - COMPACT */
.form-label {
    margin-bottom: 0.25rem !important; /* Redus de la 0.5rem */
    font-size: 0.875rem !important;
}

.form-control, .form-select {
    padding: 0.375rem 0.75rem !important; /* Redus de la 0.5rem 1rem */
    font-size: 0.875rem !important;
}

/* Spacing general - REDUS */
.mb-3 {
    margin-bottom: 0.75rem !important; /* Redus de la 1rem */
}

.mb-4 {
    margin-bottom: 1rem !important; /* Redus de la 1.5rem */
}

.mt-3 {
    margin-top: 0.75rem !important;
}

.mt-4 {
    margin-top: 1rem !important;
}

.py-3 {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
}

.py-4 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
}

.p-3 {
    padding: 0.75rem !important;
}

.p-4 {
    padding: 1rem !important;
}

