/* ============================================
   Virkisskipan — Sidebar layout inspired by portal.bizconnect.dk
   ============================================ */

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    background: #f0f4f8;
}

a {
    color: #1a3a6b;
    text-decoration: none;
}
a:hover {
    color: #c00;
}

/* ---- App wrapper (sidebar + main) ---- */
.app-wrap {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: 250px;
    min-width: 250px;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(-250px);
}

.sidebar-logo {
    padding: 24px 20px 20px;
    border-bottom: 1px solid #e5e7eb;
}
.sidebar-logo a {
    text-decoration: none;
}
.logo-tg {
    color: #c00;
    font-weight: 800;
    font-size: 1.6em;
}
.logo-text {
    color: #1a3a6b;
    font-weight: 600;
    font-size: 1.2em;
    margin-left: 2px;
}

/* ---- Sidebar navigation ---- */
.sidebar-nav {
    padding: 12px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: #3c3c3c;
    font-size: 0.93em;
    transition: background 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}
.menu-item:hover {
    background: linear-gradient(to right, #dbeafe, #fff);
    color: #1a3a6b;
}
.menu-item.active {
    background: linear-gradient(to right, #b3d4fc, #fff);
    color: #1a3a6b;
    font-weight: 600;
}

.menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    color: #1a3a6b;
}

.menu-section {
    margin-top: 2px;
}

.menu-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: #3c3c3c;
    font-size: 0.93em;
    font-weight: 500;
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    transition: background 0.2s;
}
.menu-heading:hover {
    background: linear-gradient(to right, #dbeafe, #fff);
}
.menu-heading .chevron {
    margin-left: auto;
    transition: transform 0.2s;
    color: #9ca3af;
}
.menu-heading.open .chevron {
    transform: rotate(180deg);
}

.menu-sub {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.menu-sub.open {
    max-height: 600px;
}

.menu-item.sub {
    padding: 7px 20px 7px 52px;
    font-size: 0.88em;
}

/* ---- Main content ---- */
.main-content {
    flex: 1;
    margin-left: 250px;
    min-height: 100vh;
    background: linear-gradient(135deg, #e8f0fe 0%, #dbeafe 50%, #c7d8f0 100%);
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.main-content.expanded {
    margin-left: 0;
}

/* ---- Top bar ---- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 30px;
    background: transparent;
}

.btn-toggle-sidebar {
    background: none;
    border: none;
    color: #1a3a6b;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background 0.2s;
}
.btn-toggle-sidebar:hover {
    background: rgba(255,255,255,0.5);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-user {
    color: #4b5563;
    font-size: 0.9em;
}

.btn-logout {
    background: #1a3a6b;
    color: #fff;
    border: none;
    padding: 7px 20px;
    border-radius: 20px;
    font-size: 0.88em;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-logout:hover {
    background: #c00;
}

/* ---- Content card ---- */
.content-card {
    background: #fff;
    border-radius: 20px;
    padding: 30px;
    margin: 0 30px;
    flex: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* ---- Footer ---- */
.app-footer {
    text-align: center;
    padding: 16px;
    color: #6b7280;
    font-size: 0.85em;
}

/* ---- Login page ---- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a3a6b 0%, #2d5aa0 100%);
}

.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 50px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card .logo-tg {
    font-size: 2em;
}
.login-card .logo-text {
    font-size: 1.5em;
}
.login-card h2 {
    color: #1a3a6b;
    margin: 20px 0 6px;
    font-size: 1.3em;
}
.login-card .subtitle {
    color: #6b7280;
    margin-bottom: 28px;
    font-size: 0.9em;
}

.login-card .form-control {
    border-radius: 10px;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    font-size: 0.95em;
}
.login-card .form-control:focus {
    border-color: #1a3a6b;
    box-shadow: 0 0 0 3px rgba(26,58,107,0.1);
}

.login-card .btn-login {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    background: #1a3a6b;
    color: #fff;
    border: none;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.login-card .btn-login:hover {
    background: #2d5aa0;
}

/* ---- Form styling ---- */
.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}
.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* ---- Bootstrap overrides ---- */
.btn-primary {
    background: #1a3a6b;
    border-color: #1a3a6b;
}
.btn-primary:hover {
    background: #2d5aa0;
    border-color: #2d5aa0;
}

/* ---- Tables ---- */
.table tfoot td {
    font-weight: bold;
    border-top: 2px solid #333;
}

/* ---- Dashboard cards ---- */
.card.text-white a {
    color: rgba(255,255,255,0.85);
}
.card.text-white a:hover {
    color: #fff;
}

/* ---- Company header — hidden on screen, visible when printing ---- */
.company-header {
    display: none;
}

/* ---- Print styles ---- */
@media print {
    .sidebar, .topbar, .app-footer, .no-print, .btn, form.report-filters {
        display: none !important;
    }
    .company-header {
        display: block !important;
    }
    .main-content {
        margin-left: 0 !important;
        background: none !important;
    }
    .content-card {
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }
    body { margin: 0; background: #fff !important; }
    .container, .container-fluid { max-width: 100%; padding: 0; }
    .table { font-size: 11px; }
    .table th, .table td { padding: 2px 6px; }
    h1 { font-size: 18px; margin-bottom: 8px; }
    .report-header { margin-bottom: 10px; }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-250px);
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .content-card {
        margin: 0 12px;
        padding: 16px;
        border-radius: 12px;
    }
    .topbar {
        padding: 10px 16px;
    }
}

/* ---- User management table ---- */
.users-table th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.88em;
    color: #4b5563;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
