/* =========================
   RESET & BASE
   ========================= */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: Arial, sans-serif;
    background: #0a0e27 url('https://www.auto10.lt/wp-content/uploads/2024/03/bg_auto10v2.jpg') no-repeat center center fixed;
    background-size: cover;
    color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: inherit; text-decoration: none; }
h1 { font-size: 22px; margin-bottom: 15px; font-weight: bold; }
h2 { font-size: 18px; margin-bottom: 12px; font-weight: bold; }

/* =========================
   HEADER & LOGO
   ========================= */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: rgba(10, 14, 39, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin: 10px;
    position: relative;
    z-index: 5000;
}
.header-left { display: flex !important; align-items: center !important; gap: 16px !important; flex-direction: row !important; }
.header-logo { height: 50px !important; width: auto !important; max-width: 250px !important; object-fit: contain; vertical-align: middle; }
.title { font-size: 28px; font-weight: bold; letter-spacing: 1px; }
.title.is-company { text-transform: none !important; letter-spacing: 0.5px !important; }

/* =========================
   CZ BUTTONS STANDARTAS
   ========================= */
.cz-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 8px 18px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9);
    font-size: 13px; font-weight: 600; cursor: pointer; user-select: none;
    transition: all 0.2s ease; text-decoration: none; line-height: 1.2;
}
.cz-btn:hover { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.3); transform: translateY(-1px); color: #fff; }

/* AKTYVI BŪSENA (Mėlyna) */
.cz-btn.active, .cz-btn-primary, .cz-btn-edit { 
    background: rgba(37, 99, 235, 0.25) !important; 
    border-color: rgba(37, 99, 235, 0.4) !important; 
}
.cz-btn.active:hover, .cz-btn-primary:hover, .cz-btn-edit:hover { 
    background: rgba(37, 99, 235, 0.45) !important; 
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.2);
    transform: translateY(-1px);
}

/* KITOS SPALVOS */
.cz-btn-danger { background: rgba(220, 38, 38, 0.25) !important; border-color: rgba(220, 38, 38, 0.4) !important; }
.cz-btn-danger:hover { background: rgba(220, 38, 38, 0.45) !important; box-shadow: 0 0 15px rgba(220, 38, 38, 0.2); }

.cz-btn-view { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); }

.cz-btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 8px; }

/* HEADER IR LOGIN FIXES */
.user-avatar-icon { 
    width: 32px !important; height: 32px !important; 
    display: flex !important; align-items: center !important; justify-content: center !important; 
    font-size: 20px !important; color: #fff !important; 
    position: relative !important;
}

.user-info { 
    display: flex !important; align-items: center !important; justify-content: center !important; 
    cursor: pointer !important; padding: 4px 12px !important; 
    background: rgba(255, 255, 255, 0.05) !important; border-radius: 8px !important; 
    height: 40px !important; transition: all 0.2s ease !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
}
.user-info:hover { 
    background: rgba(255, 255, 255, 0.12) !important; 
    border-color: rgba(255, 255, 255, 0.3) !important;
    transform: translateY(-1px);
}
.user-info:hover .user-avatar-icon { color: #3b82f6; }

.user-status-dot {
    position: absolute; bottom: -1px; right: -1px;
    width: 10px; height: 10px; background: #10b981;
    border: 2px solid #0f172a; border-radius: 50%;
}

/* LOGIN / AUTH FORM BUTTONS - FULL UNIFICATION WITH cz-btn */
.btn-primary, .btn-primary-auth {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 25px; border-radius: 10px; border: 1px solid rgba(37, 99, 235, 0.4) !important;
    background: rgba(37, 99, 235, 0.25) !important; color: #fff !important; font-weight: 600;
    cursor: pointer; transition: all 0.2s ease !important; font-family: inherit; font-size: 14px;
}
.btn-primary:hover, .btn-primary-auth:hover {
    background: rgba(37, 99, 235, 0.45) !important; 
    border-color: rgba(37, 99, 235, 0.6) !important;
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.2);
    transform: translateY(-1px);
}
.user-status-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: #10b981; /* Ryškiai žalia */
    border: 2px solid #0f172a; /* Tamsus apvadas, kad atsiskirtų */
    border-radius: 50%;
}
.user-dropdown-info {
    padding: 12px 20px;
    font-size: 13px;
    color: rgba(255,255,255,0.5);
    text-align: right;
    font-style: italic;
    word-break: break-all;
}
.user-info { display: flex !important; align-items: center !important; gap: 10px !important; cursor: pointer !important; padding: 4px 8px !important; background: rgba(255, 255, 255, 0.05) !important; border-radius: 6px !important; height: 40px !important; }

/* DROPDOWN LOGIKA */
.user-dropdown.show, #companySwitcher.show { display: block !important; }
.user-dropdown { 
    position: absolute; right: 0; top: 100%; margin-top: 6px; 
    background: #0f172a; border: 1px solid rgba(255, 255, 255, 0.2); 
    border-radius: 8px; 
    min-width: 200px; 
    display: none; z-index: 10000; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    text-align: right;
    padding: 5px 0;
}
.user-dropdown-info {
    padding: 10px 20px;
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    text-align: right;
    font-style: italic;
}
.user-menu-divider {
    height: 1px;
    background: rgba(255,255,255,0.15);
    margin: 5px 0;
}
.user-dropdown a { 
    display: block; 
    padding: 10px 20px; 
    color: #fff; 
    text-align: right; 
    white-space: nowrap;
    font-size: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.user-dropdown a:hover {
    background: rgba(255,255,255,0.05);
}
.user-dropdown a:last-child {
    border-bottom: none;
}
.menu-item-disabled {
    opacity: 0.3;
    cursor: default !important;
    pointer-events: none;
}
.auth-close:hover { opacity: 1 !important; transform: scale(1.1); }
#companySwitcher { z-index: 10001 !important; }

/* =========================
   SIDEBAR MENU
   ========================= */
.app-container { display: flex; flex: 1; gap: 10px; padding: 5px 10px; position: relative; }
.sidebar { width: 250px; flex-shrink: 0; background: rgba(10, 14, 39, 0.15); border-radius: 8px; padding: 15px !important; border: 1px solid rgba(255, 255, 255, 0.1); transition: width 0.3s ease; }
.sidebar.collapsed { width: 70px; padding: 15px 10px !important; }
.sidebar.collapsed h3, .sidebar.collapsed .menu-text { display: none !important; }
.sidebar-header { display: flex !important; flex-direction: row !important; justify-content: space-between !important; align-items: center !important; margin-bottom: 12px; height: 30px; white-space: nowrap; }
.sidebar h3 { font-size: 15px; text-transform: uppercase; letter-spacing: 1px; margin: 0; }
.toggle-btn { background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); color: #fff; width: 28px; height: 28px; border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

.sidebar ul { list-style: none !important; padding: 0 !important; margin: 0 !important; }
.sidebar li { list-style: none !important; display: block; margin-bottom: 4px; }
.sidebar a { display: flex; align-items: center; padding: 8px 12px; color: #fff; border-radius: 6px; background: rgba(255, 255, 255, 0.05); margin-bottom: 4px; position: relative; font-size: 14px; }
.sidebar a:hover { background: rgba(255, 255, 255, 0.15); }
.sidebar a.active { background: rgba(255, 255, 255, 0.15) !important; border: 1px solid rgba(255, 255, 255, 0.1); font-weight: 600; }

.sidebar .submenu a { padding-left: 25px; background: rgba(255, 255, 255, 0.02); }
.sidebar .submenu .submenu a { padding-left: 35px; }

/* Submenu suskleistame režime */
.sidebar.collapsed a { justify-content: center !important; padding: 8px 0 !important; margin-bottom: 4px !important; background: rgba(255, 255, 255, 0.05) !important; border-radius: 6px !important; }
.sidebar.collapsed .submenu a { padding-left: 0 !important; background: rgba(255, 255, 255, 0.02) !important; }
.menu-icon { min-width: 22px; text-align: center; margin-right: 12px; font-size: 16px; }
.sidebar.collapsed .menu-icon { margin-right: 0 !important; width: 100% !important; display: flex !important; justify-content: center !important; align-items: center !important; }

.menu-item-parent > a::after { content: '▼'; font-size: 9px; margin-left: auto; opacity: 0.5; transition: transform 0.3s; }
.menu-item-parent.open > a::after { transform: rotate(180deg); }
.sidebar.collapsed .menu-item-parent > a::after { display: none !important; }

.submenu { display: none !important; margin: 0; padding: 0; list-style: none !important; }
.menu-item-parent.open > .submenu { display: block !important; }

.menu-locked { opacity: 0.5 !important; cursor: pointer !important; }
.menu-locked a { background: rgba(255, 255, 255, 0.03) !important; border: 1px solid rgba(255, 255, 255, 0.05) !important; }
.menu-locked a::after { 
    content: '\f023' !important; 
    font-family: "Font Awesome 6 Free", "Font Awesome 7 Free" !important; 
    font-weight: 900 !important; 
    font-size: 12px !important; 
    margin-left: auto; 
    color: #dc2626 !important;
    opacity: 1 !important; 
}

/* =========================
   TABLES & ACTIONS
   ========================= */
.table-responsive { width: 100% !important; overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
#main-content { flex: 1; padding: 15px; background: rgba(10, 14, 39, 0.15); border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.1); }
.table { width: 100% !important; border-collapse: separate !important; border-spacing: 0 !important; background: rgba(255, 255, 255, 0.02); border: 1px solid rgba(255, 255, 255, 0.1) !important; border-radius: 10px; overflow: hidden; }
.table th, .table td { padding: 6px 10px !important; vertical-align: middle; border-bottom: 1px solid rgba(255, 255, 255, 0.05); border-right: 1px solid rgba(255, 255, 255, 0.05); color: rgba(255, 255, 255, 0.85); font-size: 13px; }
.table th:last-child, .table td:last-child { text-align: center !important; border-right: none !important; }
.table thead th { background: rgba(0, 0, 0, 0.3) !important; font-weight: bold !important; color: #fff !important; letter-spacing: 0.5px; }
.table-hover tbody tr:hover { background-color: rgba(255, 255, 255, 0.07) !important; }

.table td > div { display: flex; gap: 8px; justify-content: center; align-items: center; white-space: nowrap; }
.btn-action { display: inline-block !important; padding: 2px 10px !important; border-radius: 4px !important; font-size: 11px !important; color: #fff !important; text-align: center !important; min-width: 50px; cursor: pointer !important; transition: background 0.2s; }
.btn-view { background: #4b5563 !important; }
.btn-edit { background: #2563eb !important; }

/* =========================
   MODALS (COMPACT & CENTERED)
   ========================= */
.modal { 
    position: fixed !important; 
    inset: 0 !important; 
    background: rgba(0,0,0,0.75) !important; 
    z-index: 99999 !important; 
    display: none; 
    align-items: center !important; 
    justify-content: center !important; 
}
.modal[style*="display: block"], .modal[style*="display:block"] { display: flex !important; }
.modal-content { 
    background: #0f172a !important; 
    border-radius: 12px !important; 
    border: 1px solid rgba(255,255,255,0.15) !important; 
    width: 95% !important; 
    max-width: 600px !important; 
    box-shadow: 0 20px 60px rgba(0,0,0,0.8) !important; 
    padding: 0 !important; 
    margin: auto !important; 
    position: relative !important; 
    overflow: hidden !important; 
}
.modal-header { padding: 10px 15px; border-bottom: 1px solid rgba(255,255,255,0.05); display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { font-size: 18px; margin: 0; color: #fff; }
.modal-close { background: none; border: none; color: #fff; font-size: 24px; cursor: pointer; opacity: 0.7; }
.modal-body { padding: 10px 15px !important; color: #fff !important; }
.modal-footer { padding: 8px 15px; background: rgba(0,0,0,0.2); border-top: 1px solid rgba(255,255,255,0.05); display: flex; justify-content: flex-end; gap: 8px; }
.modal-card { background: rgba(255,255,255,0.03); border-radius: 10px; padding: 10px; border: 1px solid rgba(255,255,255,0.05); width: 100%; }

.form-grid { display: grid; grid-template-columns: 120px 1fr; row-gap: 4px; column-gap: 15px; align-items: center; width: 100%; }
.form-label { text-align: right; font-weight: 600; color: rgba(255,255,255,0.7); font-size: 12px; }
.form-control { width: 100%; height: 32px; padding: 4px 10px; background: rgba(255,255,255,0.95); border-radius: 6px; border: none; color: #000; font-size: 13px; }

/* DISABLED FIELDS FIX */
.form-control:disabled { 
    background: #e9ecef !important; 
    color: #6c757d !important; 
    cursor: not-allowed !important; 
    border: 1px solid #ced4da !important; 
    opacity: 1 !important;
}

.form-row-separator { grid-column: 1 / -1; height: 1px; background: rgba(255,255,255,0.05); margin: 2px 0; }
.btn-modal-primary { background: #3b6df6 !important; color: #fff !important; padding: 6px 20px !important; border-radius: 6px !important; font-weight: 600 !important; border: none !important; cursor: pointer !important; font-size: 13px !important; }
.btn-modal-secondary { background: #6c757d !important; color: #fff !important; padding: 6px 15px !important; border-radius: 6px !important; border: none !important; cursor: pointer !important; font-size: 13px !important; }
.btn-modal-warning { background: #f0ad4e !important; color: #000 !important; padding: 10px 20px !important; border-radius: 8px !important; font-weight: 600 !important; border: none !important; cursor: pointer !important; font-size: 13px !important; }

/* =========================
   NEWS, AUTH, FOOTER
   ========================= */
.news-item { background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; padding: 20px; margin-bottom: 20px; cursor: pointer; transition: all 0.3s ease; }
.news-header { display: flex; gap: 20px; align-items: flex-start; }
.news-image { width: 80px !important; height: auto !important; object-fit: contain; border-radius: 6px; flex-shrink: 0; }
.news-item.expanded .news-image { width: 25% !important; max-width: 250px !important; }
.news-preview, .news-full { display: inline; color: #fff; font-family: inherit; font-size: 14px; line-height: 1.5; }
.news-full { display: none; }
.news-item.expanded .news-full { display: inline !important; }
.news-item.expanded .news-preview { display: none !important; }
.news-more { display: inline !important; margin-left: 5px !important; color: rgba(255, 255, 255, 0.5) !important; font-size: 13px !important; cursor: pointer !important; text-decoration: underline !important; }
.news-title { font-weight: bold; font-size: 18px; margin-bottom: 5px; }
.news-date { font-size: 12px; opacity: 0.5; margin-bottom: 10px; }

#main-content.auth-layout { background: transparent !important; border: none !important; padding: 0 !important; }
.auth-page { display: flex; flex: 1; justify-content: center; align-items: center; min-height: 70vh; width: 100%; }
.auth-box { width: 100%; max-width: 420px; padding: 25px; background: rgba(10, 14, 39, 0.4) !important; border: 1px solid rgba(255, 255, 255, 0.1) !important; border-radius: 12px !important; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.auth-box h2 { text-align: center; margin-bottom: 20px; font-size: 22px; }
.btn-primary { background: linear-gradient(135deg, #1f3c88, #274b9f); color: #fff; padding: 7px 18px; border-radius: 6px; border: none; font-weight: 600; cursor: pointer; text-align: center; display: inline-block; width: auto; font-size: 13px; }
.auth-box .btn-primary { width: 100% !important; margin-top: 15px !important; }
.btn-secondary { background: rgba(255, 255, 255, 0.1) !important; border: 1px solid rgba(255, 255, 255, 0.2) !important; color: #fff !important; padding: 10px 25px !important; border-radius: 6px !important; font-weight: 600 !important; text-decoration: none !important; display: inline-block !important; font-size: 13px !important; cursor: pointer !important; }

/* Subtle Buttons (Login, Language) */
.language-btn { 
    background: rgba(255, 255, 255, 0.08) !important; 
    border: 1px solid rgba(255, 255, 255, 0.2) !important; 
    color: #fff !important; 
    padding: 8px 20px; 
    border-radius: 6px; 
    font-size: 13px; 
    display: inline-block; 
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}
.language-btn:hover { 
    background: rgba(255, 255, 255, 0.15) !important; 
    border-color: rgba(255, 255, 255, 0.3) !important; 
}

footer { background: rgba(10, 14, 39, 0.15); padding: 20px; text-align: center; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; margin: 10px; }
.mobile-menu-toggle { display: none; align-items: center; justify-content: center; font-size: 20px; color: #fff; cursor: pointer; padding: 8px 15px; background: rgba(255, 255, 255, 0.05); border-radius: 6px; height: 38px; min-width: 50px; }

@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    header { flex-direction: row !important; justify-content: space-between !important; padding: 10px 15px !important; gap: 10px !important; }
    .header-left { flex-direction: column !important; align-items: flex-start !important; gap: 2px !important; }
    /* Logo height unified in earlier section */
    .title { font-size: 18px !important; letter-spacing: 0.5px !important; }
    .mobile-menu-toggle, .user-info { height: 38px !important; min-width: 50px !important; padding: 5px 10px !important; }
    .mobile-menu-toggle { display: flex !important; } 
    .sidebar { display: none !important; width: calc(100% - 20px) !important; position: fixed !important; top: 95px !important; left: 10px !important; z-index: 10000 !important; background: #0f172a !important; box-shadow: 0 10px 40px rgba(0,0,0,0.8) !important; border: 1px solid rgba(255, 255, 255, 0.1) !important; height: auto !important; max-height: calc(100vh - 110px); overflow-y: auto; }
    .sidebar.mobile-open { display: block !important; }
    .sidebar-header { display: none !important; }
    .table th:first-child, .table td:first-child { display: none !important; } 
    .col-hide-mobile { display: none !important; } 
    #companiesTable th:nth-child(2), #companiesTable td:nth-child(2), #companiesTable th:nth-child(4), #companiesTable td:nth-child(4) { display: none !important; }
    .table td > div { display: flex !important; flex-direction: column !important; gap: 5px !important; align-items: center !important; white-space: normal !important; }
    .form-grid { grid-template-columns: 80px 1fr !important; }
    .form-label { font-size: 11px !important; }
    .news-image { display: none !important; }
    .news-item.expanded .news-image { display: block !important; width: 100% !important; max-width: 300px !important; margin: 15px auto !important; order: 3; }
    .news-item.expanded .news-header { display: flex; flex-direction: column; }
    .news-item.expanded .news-info { display: contents; }
    .news-title { order: 1; }
    .news-date { order: 2; }
    .news-content { order: 4; }
}
