/* === Bro-Bålstastädarna Tid — bbstad.se tema === */
:root {
    --primary: rgb(130, 160, 40);
    --primary-dark: rgb(105, 135, 25);
    --accent: rgb(0, 130, 124);
    --heading: #333333;
    --text: #555555;
    --bg: #f4f6f9;
    --bg-light: #f7f9fc;
    --border: rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.05);
    --danger: #e74c3c;
    --danger-dark: #c0392b;
    --success: rgb(130, 160, 40);
    --alert-success-bg: rgba(130, 160, 40, 0.12);
    --alert-success-text: #3d6b00;
    --alert-success-border: rgba(130, 160, 40, 0.3);
    --alert-error-bg: rgba(231, 76, 60, 0.08);
    --alert-error-text: #c0392b;
    --alert-error-border: rgba(231, 76, 60, 0.2);
    --badge-active-bg: rgba(130, 160, 40, 0.15);
    --badge-inactive-bg: rgba(231, 76, 60, 0.1);
    --btn-secondary-bg: rgba(255, 255, 255, 0.7);
    --btn-secondary-hover: rgba(255, 255, 255, 0.9);
    --modal-overlay-bg: rgba(0, 0, 0, 0.4);
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --sidebar-width: 240px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Oxygen', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--primary-dark); }

h1, h2, h3, h4 { color: var(--heading); font-weight: 600; font-family: 'Jost', sans-serif; }

/* Layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, rgb(0, 105, 100) 0%, rgb(0, 80, 76) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.sidebar-brand {
    padding: 28px 20px;
    font-size: 1.15rem;
    font-weight: 700;
    font-family: 'Jost', sans-serif;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    text-align: center;
    line-height: 1.3;
}

.sidebar-brand span {
    display: block;
    font-size: .75rem;
    font-weight: 400;
    opacity: .55;
    margin-top: 4px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.sidebar-nav {
    list-style: none;
    padding: 16px 0;
    flex: 1;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    margin: 2px 10px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.75);
    font-size: .95rem;
    transition: all .2s ease;
}

.sidebar-nav li a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.sidebar-nav li a.active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    backdrop-filter: blur(4px);
}

.sidebar-nav li a .icon {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 36px 44px;
    min-height: 100vh;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-light);
}

.page-header h1 {
    font-size: 1.6rem;
}

/* Cards — glassmorphism */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--glass-shadow);
    transition: box-shadow .2s ease, transform .2s ease;
}

.card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
}

.card-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 28px 24px;
    text-align: center;
    border-top: 3px solid var(--accent);
    box-shadow: var(--glass-shadow);
    transition: transform .2s ease, box-shadow .2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
}

.stat-card .stat-number {
    font-size: 2.4rem;
    font-weight: 700;
    font-family: 'Jost', sans-serif;
    color: var(--accent);
    line-height: 1;
}

.stat-card .stat-label {
    margin-top: 8px;
    font-size: .9rem;
    color: var(--text);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(130, 160, 40, 0.35);
}
.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
    box-shadow: 0 6px 20px rgba(130, 160, 40, 0.45);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 4px 14px rgba(231, 76, 60, 0.25);
}
.btn-danger:hover {
    background: var(--danger-dark);
    color: #fff;
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--btn-secondary-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--heading);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--btn-secondary-hover);
}

.btn-sm {
    padding: 6px 12px;
    font-size: .82rem;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

table th {
    background: rgba(0, 160, 152, 0.06);
    font-weight: 600;
    color: var(--heading);
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}

table tr {
    transition: background .15s ease;
}

table tr:hover {
    background: rgba(0, 160, 152, 0.04);
}

table .actions {
    display: flex;
    gap: 6px;
}

/* Forms */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--heading);
    font-size: .9rem;
}

.form-group input:not([type="checkbox"]),
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: 'Oxygen', sans-serif;
    font-size: .95rem;
    color: var(--heading);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: all .2s ease;
}

.form-group input:not([type="checkbox"]):focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 3px rgba(0, 160, 152, 0.12);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Modal — glassmorphism */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--modal-overlay-bg);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.18);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h2 {
    font-size: 1.15rem;
}

.modal-close {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 500;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.badge-active {
    background: var(--badge-active-bg);
    color: var(--success);
    text-transform: uppercase;
}

.badge-inactive {
    background: var(--badge-inactive-bg);
    color: var(--danger);
    text-transform: uppercase;
}

/* Checkbox list for assigning employees */
.checkbox-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.6);
}

.checkbox-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: 6px;
    font-weight: 400;
    transition: background .15s ease;
}

.checkbox-list label:hover {
    background: rgba(0, 160, 152, 0.06);
}

/* Custom checkboxes */
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid var(--border);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    position: relative;
    transition: all .2s ease;
}

input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 6px;
    height: 11px;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

input[type="checkbox"]:hover {
    border-color: var(--accent);
}

/* Standalone checkbox label (e.g. "Aktiv") */
.form-group > label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 400;
    padding: 8px 0;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: .9rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.alert-success {
    background: var(--alert-success-bg);
    color: var(--alert-success-text);
    border: 1px solid var(--alert-success-border);
}

.alert-error {
    background: var(--alert-error-bg);
    color: var(--alert-error-text);
    border: 1px solid var(--alert-error-border);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: .4;
}

/* Login page */
.login-page {
    background: linear-gradient(135deg, rgb(0, 105, 100) 0%, rgb(0, 80, 76) 50%, rgb(0, 60, 57) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 40px 32px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
}

.login-brand {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    font-family: 'Jost', sans-serif;
    color: var(--heading);
    margin-bottom: 28px;
    line-height: 1.3;
}

.login-brand span {
    display: block;
    font-size: .75rem;
    font-weight: 400;
    color: var(--text);
    opacity: .6;
    margin-top: 4px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.login-btn {
    width: 100%;
    justify-content: center;
    padding: 12px 20px;
    font-size: 1rem;
    margin-top: 8px;
}

/* Sidebar user info */
.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    text-align: center;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: .9rem;
    color: #fff;
}

.sidebar-user-role {
    font-size: .75rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 2px;
}

.sidebar-logout {
    display: inline-block;
    margin-top: 8px;
    font-size: .8rem;
    color: rgba(255, 255, 255, 0.7);
    transition: color .2s ease;
}

.sidebar-logout:hover {
    color: #fff;
}

/* Mobile top bar — hidden on desktop */
.mobile-topbar {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        flex-direction: row;
        z-index: 1000;
        background: linear-gradient(180deg, rgb(0, 105, 100) 0%, rgb(0, 80, 76) 100%);
    }
    .sidebar-brand {
        display: none;
    }
    .sidebar-nav {
        display: flex;
        flex-direction: row;
        padding: 0;
        width: 100%;
        justify-content: space-around;
    }
    .sidebar-nav li {
        flex: 1;
    }
    .sidebar-nav li a {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2px;
        padding: 10px 4px;
        margin: 0;
        border-radius: 0;
        font-size: .95rem;
    }
    .sidebar-nav li a .label {
        display: block;
        font-size: .6rem;
        white-space: nowrap;
    }
    .sidebar-nav li a .icon {
        font-size: 1.2rem;
    }
    .sidebar-nav li a.active {
        background: rgba(255, 255, 255, 0.15);
        backdrop-filter: none;
    }
    .sidebar-user {
        display: none;
    }
    .mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 48px;
        padding: 0 16px;
        background: linear-gradient(180deg, rgb(0, 105, 100) 0%, rgb(0, 80, 76) 100%);
        color: #fff;
        z-index: 1001;
    }
    .mobile-topbar-brand {
        font-family: 'Jost', sans-serif;
        font-weight: 700;
        font-size: 1.05rem;
    }
    .mobile-topbar-logout {
        color: rgba(255, 255, 255, 0.8);
        font-size: .82rem;
    }
    .mobile-topbar-logout:hover {
        color: #fff;
    }
    .main-content {
        margin-left: 0;
        padding: 16px;
        padding-top: 64px;
        padding-bottom: 80px;
    }
    .page-header {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }
    .page-header h1 {
        font-size: 1.3rem;
    }
    .form-row {
        grid-template-columns: 1fr;
    }

    /* Stats grid mobile */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 16px;
    }
    .stat-card {
        padding: 16px;
        display: flex;
        align-items: center;
        gap: 12px;
        text-align: left;
    }
    .stat-card .stat-number {
        font-size: 1.8rem;
        min-width: 48px;
    }
    .stat-card .stat-label {
        margin-top: 0;
    }

    /* Responsive tables — card layout */
    .table-wrapper {
        overflow-x: visible;
    }
    .table-wrapper table,
    .table-wrapper thead,
    .table-wrapper tbody,
    .table-wrapper th,
    .table-wrapper tr,
    .table-wrapper td {
        display: block;
    }
    .table-wrapper thead {
        display: none;
    }
    .table-wrapper tr {
        background: rgba(255, 255, 255, 0.5);
        border: 1px solid var(--border-light);
        border-radius: 10px;
        margin-bottom: 10px;
        padding: 12px 14px;
    }
    .table-wrapper tr:hover {
        background: rgba(255, 255, 255, 0.7);
    }
    .table-wrapper td {
        padding: 4px 0;
        border-bottom: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: .88rem;
    }
    .table-wrapper td:before {
        content: attr(data-label);
        font-weight: 600;
        font-size: .78rem;
        color: var(--heading);
        text-transform: uppercase;
        letter-spacing: .3px;
        margin-right: 12px;
        flex-shrink: 0;
    }
    .table-wrapper td .actions {
        justify-content: flex-end;
        width: 100%;
    }
    .table-wrapper td:empty {
        display: none;
    }

    /* Cards mobile */
    .card {
        padding: 16px;
        border-radius: 10px;
    }

    /* Modal mobile */
    .modal {
        width: 95%;
        max-height: 85vh;
        border-radius: 14px;
    }
    .modal-header {
        padding: 16px;
    }
    .modal-body {
        padding: 16px;
    }
    .modal-footer {
        padding: 12px 16px;
    }

    /* Buttons mobile */
    .page-header .btn {
        padding: 8px 14px;
        font-size: .82rem;
    }
}
