/* ══════════════════════════════════════════
   BASE STYLES - Common for all pages
══════════════════════════════════════════ */

body {
    background: #f5f6fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
}

/* ── Navbar ── */
.navbar {
    padding: 12px 20px;
}
.nav-link {
    border-radius: 6px;
    transition: background 0.2s ease;
}
.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,0.15);
}

/* ── Cards ── */
.card {
    border-radius: 12px !important;
    border: none !important;
}
.card-header-custom {
    background: linear-gradient(135deg, #1a73e8, #0d47a1);
    color: white;
    padding: 14px 20px;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 12px 12px 0 0 !important;
}

/* ── Stat Cards ── */
.stat-card {
    border-radius: 16px !important;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    cursor: default;
}
.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.18) !important;
}
.stat-icon {
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}
.stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 4px;
}

/* ── Mini Cards ── */
.mini-card {
    border-radius: 12px !important;
    transition: transform 0.2s ease;
}
.mini-card:hover {
    transform: translateY(-4px);
}
.mini-number {
    font-size: 1.6rem;
    font-weight: 700;
}
.mini-label {
    font-size: 0.78rem;
    color: #6c757d;
    margin-top: 2px;
}

/* ── Table ── */
.table th {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    vertical-align: middle;
    padding: 10px 8px;
}
.table td {
    font-size: 12px;
    vertical-align: middle;
    padding: 8px;
}
.table-responsive { overflow-y: auto; }
.table thead { position: sticky; top: 0; z-index: 10; }

/* ── Badges ── */
.badge {
    font-size: 11px;
    padding: 5px 10px;
    border-radius: 20px;
    font-weight: 600;
}

/* ── Buttons ── */
.btn {
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
}
.btn:hover { transform: translateY(-1px); }

/* ── Form Controls ── */
.form-control {
    border-radius: 8px;
    border: 1.5px solid #dee2e6;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-control:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26,115,232,0.15);
}

/* ── Alert ── */
.alert {
    border-radius: 10px;
    border: none;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
::-webkit-scrollbar-thumb { background: #1a73e8; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #0d47a1; }

/* ── Back Button ── */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}
.back-btn:hover {
    transform: translateX(-4px);
}

/* ── Date Filter Card ── */
.filter-card {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-radius: 12px;
}

/* ── Company Banner ── */
.company-banner {
    background: #e3f2fd;
    border-radius: 10px;
    border-left: 4px solid #1a73e8;
    color: #0d47a1;
}

/* ══════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════ */
.company-sidebar {
    width: 280px;
    min-width: 280px;
    background: #fff;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
    position: sticky;
    top: 56px;
    height: calc(100vh - 56px);
    transition: all 0.3s ease;
    z-index: 100;
}
.company-sidebar.sidebar-hidden {
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    border: none;
}
.sidebar-header {
    background: linear-gradient(135deg, #1a73e8, #0d47a1);
    color: white;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 5;
}
.sidebar-open-btn {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 200;
    border-radius: 0 8px 8px 0;
    padding: 8px 10px;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.2);
}
.company-sidebar::-webkit-scrollbar { width: 4px; }
.company-sidebar::-webkit-scrollbar-thumb {
    background: #1a73e8;
    border-radius: 10px;
}

/* ── Tree Styles ── */
.tree-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 6px;
    color: #333;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tree-item:hover {
    background: #f0f4ff !important;
    color: #1a73e8 !important;
}
.tree-item-selected {
    background: #e3f2fd !important;
    color: #1a73e8 !important;
    font-weight: 600;
}
.tree-icon {
    color: #1a73e8;
    font-size: 12px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}
.tree-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tree-toggle-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 11px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.tree-toggle-btn:hover { background: #e3f2fd; color: #1a73e8; }
.tree-chevron {
    transition: transform 0.2s ease;
    font-size: 10px;
}
.tree-chevron.rotated { transform: rotate(90deg); }
.tree-children {
    border-left: 2px solid #e3f2fd;
    margin-left: 10px;
    padding-left: 4px;
    overflow: hidden;
    transition: all 0.2s ease;
}
.tree-children .tree-children { border-left-color: #bbdefb; }
.tree-children .tree-children .tree-children { border-left-color: #90caf9; }

/* ══════════════════════════════════════════
   MULTI-COMPANY SELECTION STYLES
══════════════════════════════════════════ */

.tree-checkbox {
    width: 15px;
    height: 15px;
    accent-color: #1a73e8;
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 3px;
    margin-top: 1px;
}

.selected-companies-bar {
    background: #e8f4fd;
    border-left: 4px solid #1a73e8;
    border-radius: 0 8px 8px 0;
    padding: 10px 12px;
    margin: 8px;
    font-size: 12px;
}

.selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #1a73e8;
    color: white;
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 11px;
    margin: 2px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-tag .remove-tag {
    cursor: pointer;
    opacity: 0.8;
    font-size: 13px;
    line-height: 1;
    flex-shrink: 0;
}
.selected-tag .remove-tag:hover {
    opacity: 1;
}

.apply-filter-btn {
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 8px;
    transition: background 0.2s;
}
.apply-filter-btn:hover {
    background: #0d47a1;
}

.clear-filter-btn {
    background: transparent;
    color: #c62828;
    border: 1px solid #c62828;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 4px;
    transition: all 0.2s;
}
.clear-filter-btn:hover {
    background: #ffebee;
}

.all-companies-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    color: #333;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.all-companies-item:hover {
    background: #f0f4ff;
    color: #1a73e8;
}
.all-companies-active {
    background: #1a73e8 !important;
    color: white !important;
    font-weight: 600;
}
.all-companies-active .tree-icon {
    color: white !important;
}

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 992px) {
    .company-sidebar {
        position: fixed;
        left: -300px;
        top: 56px;
        height: calc(100vh - 56px);
        z-index: 1020;
        box-shadow: 4px 0 20px rgba(0,0,0,0.2);
    }
    .company-sidebar.sidebar-mobile-open {
        left: 0 !important;
        width: 280px !important;
        min-width: 280px !important;
    }
    .company-sidebar.sidebar-hidden { left: -300px !important; }
}
@media (max-width: 768px) {
    .stat-number { font-size: 1.5rem; }
    .card-header-custom { font-size: 0.85rem; }
    .sidebar-open-btn { display: none !important; }
}

/* ── Print ── */
@media print {
    .navbar, form, .btn, .company-sidebar,
    .sidebar-open-btn, .back-btn { display: none !important; }
    .table { font-size: 9px !important; }
    .card { box-shadow: none !important; }
    .main-content { width: 100% !important; }
}