/* OIS Admin Panel Styles
 * Unified stylesheet for all admin pages
 * Created: 2025-04-24
 */

/* Popup-overlay och popup-details (gemensam för alla admin-sidor) */
.popup-overlay { position:fixed;top:0;left:0;width:100vw;height:100vh;background:rgba(0,0,0,0.4);z-index:1000;display:flex;align-items:center;justify-content:center; }
.popup-details { background:#fff;padding:2em;max-width:420px;border-radius:10px;box-shadow:0 8px 32px #0002; }
.popup-details h2 { margin-top:0; }
.popup-table { width:100%; border-collapse:collapse; }
.popup-table th { text-align:left; padding-right:10px; }
.popup-table td, .popup-table th { padding:4px 2px; }


:root {
    --primary-color: #4285f4;
    --primary-dark: #3367d6;
    --secondary-color: #fbbc05;
    --text-color: #333;
    --text-light: #777;
    --bg-color: #f5f5f5;
    --bg-light: #fff;
    --border-color: #ddd;
    --success-color: #34a853;
    --danger-color: #ea4335;
    --warning-color: #fbbc05;
}

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

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

.container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--bg-light);
    border-right: 1px solid var(--border-color);
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.sidebar-header h1 {
    font-size: 20px;
    color: var(--primary-color);
}

.sidebar-user {
    display: flex;
    align-items: flex-start;
    margin-top: 10px;
}

.sidebar-user-avatar {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 10px;
    font-size: 1.4em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

.sidebar-user-avatar > * {
    width: 100%;
    text-align: center;
    line-height: 44px;
}

.sidebar-user-info {
    flex: 1;
}

.sidebar-user-name {
    font-weight: bold;
}

.sidebar-user-role {
    font-size: 12px;
    color: var(--text-light);
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav-item {
    margin-bottom: 5px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.3s;
}

.sidebar-nav-link:hover,
.sidebar-nav-link.active {
    background-color: rgba(66, 133, 244, 0.1);
    color: var(--primary-color);
}

.sidebar-nav-link i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 20px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.page-title {
    font-size: 24px;
    font-weight: bold;
}

.page-actions {
    display: flex;
    gap: 10px;
}

/* Dashboard cards */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.card {
    background-color: var(--bg-light);
    border-radius: 5px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    padding: 10px;
    margin-bottom: 10px;
    min-width: 0;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 13px;
    font-weight: bold;
}

.card-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: rgba(66, 133, 244, 0.07);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.card-body {
    padding: 8px 10px;
}

.card-value {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 2px;
}

.card-description {
    color: var(--text-light);
    font-size: 11px;
}

.card-footer {
    padding: 8px 10px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

/* Alert messages */
.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-success {
    background-color: rgba(52, 168, 83, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(52, 168, 83, 0.2);
}

.alert-danger {
    background-color: rgba(234, 67, 53, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(234, 67, 53, 0.2);
}

/* Tables */
.table-container {
    margin-bottom: 40px;
    overflow-x: auto;
    display: block;
    width: 100%;
    clear: both;
}

/* Säkra vertikal stapling även om parent är flex/grid */
.main-content > .table-container {
    display: block !important;
    width: 100%;
    margin-top: 0;
    margin-bottom: 40px;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.table-title {
    font-size: 18px;
    font-weight: bold;
}

.table-actions {
    display: flex;
    gap: 10px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-light);
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

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

.table th {
    background-color: rgba(66, 133, 244, 0.05);
    font-weight: bold;
}

.table tr:last-child td {
    border-bottom: none;
}

/* --- USER STATUS BADGES (Dashboard-style for Users) --- */
.table-user-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-right: 2px;
    margin-bottom: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    border: 1px solid transparent;
}
.status-active, .status-online {
    background-color: rgba(52, 168, 83, 0.13);
    color: var(--success-color);
    border-color: rgba(52, 168, 83, 0.18);
}
.status-inactive, .status-offline {
    background-color: rgba(234, 67, 53, 0.11);
    color: var(--danger-color);
    border-color: rgba(234, 67, 53, 0.19);
}
.status-warning {
    background-color: rgba(251, 188, 5, 0.14);
    color: var(--warning-color);
    border-color: rgba(251, 188, 5, 0.19);
}
.status-ok {
    background-color: rgba(52, 168, 83, 0.09);
    color: var(--success-color);
    border-color: rgba(52, 168, 83, 0.13);
}

.table-actions-cell {
    white-space: nowrap;
}

.table-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    margin-right: 5px;
    font-size: 16px;
    transition: color 0.3s;
}

.table-action-btn:hover {
    color: var(--primary-color);
}

.table-action-btn.delete:hover {
    color: var(--danger-color);
}

/* Search and filter */
.search-filter {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.search-box {
    flex: 1;
    max-width: 300px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 15px 10px 35px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 14px;
}

.search-box i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.filter-box {
    display: flex;
    gap: 10px;
}

.filter-box select {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 14px;
    background-color: white;
}

/* Buttons */
.btn {
    padding: 8px 15px;
    border-radius: 3px;
    border: none;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    transition: background-color 0.3s;
}

.btn i {
    margin-right: 5px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: #f5f5f5;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #e5e5e5;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c62828;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 14px;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.form-check input[type="checkbox"] {
    margin-right: 10px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow: auto;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-light);
    border-radius: 5px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
}

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

.modal-title {
    font-size: 18px;
    font-weight: bold;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-light);
}

.modal-body {
    padding: 20px;
}

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

/* Login page specific */
.login-container {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 30px;
    width: 350px;
    margin: 0 auto;
}

.login-header {
    text-align: center;
    margin-bottom: 20px;
}

.login-header h1 {
    color: #333;
    font-size: 24px;
    margin: 0;
}

.login-form .form-group {
    margin-bottom: 15px;
}

.login-form button {
    width: 100%;
}

.back-link {
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
}

.back-link a {
    color: var(--primary-color);
    text-decoration: none;
}

.back-link a:hover {
    text-decoration: underline;
}

/* Activity badges */
.activity-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.activity-login {
    background-color: rgba(52, 168, 83, 0.1);
    color: var(--success-color);
}

.activity-logout {
    background-color: rgba(66, 133, 244, 0.1);
    color: var(--primary-color);
}

.activity-user-create {
    background-color: rgba(52, 168, 83, 0.1);
    color: var(--success-color);
}

.activity-user-update {
    background-color: rgba(251, 188, 5, 0.1);
    color: var(--warning-color);
}

.activity-user-delete {
    background-color: rgba(234, 67, 53, 0.1);
    color: var(--danger-color);
}

.activity-role-change {
    background-color: rgba(251, 188, 5, 0.1);
    color: var(--warning-color);
}

.activity-session-end {
    background-color: rgba(234, 67, 53, 0.1);
    color: var(--danger-color);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    gap: 5px;
}

.pagination-item {
    display: inline-block;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    background-color: var(--bg-light);
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s;
}

.pagination-item:hover {
    background-color: rgba(66, 133, 244, 0.1);
    border-color: var(--primary-color);
}

.pagination-item.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-item.disabled {
    color: var(--text-light);
    cursor: not-allowed;
}

/* Loggvisning – knappar på samma rad */
.log-toolbar-btn,
.sidebar-nav-link {
    height: 38px;
    min-height: 38px;
    padding: 0 18px;
    border-radius: 5px;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.log-toolbar-btn {
    background: #ea4335;
    color: #fff;
    margin-bottom: 0;
}

.log-toolbar-btn:hover {
    background: #d93025;
}

.sidebar-nav-link.active, .log-toolbar-btn.active {
    background: #4285f4;
    color: #fff;
}

.log-toolbar-btn-copy {
    background: #34a853;
    color: #fff;
    margin-left: 10px;
}

.log-toolbar-btn-copy:hover {
    background: #2e7d32;
}

/* --- Loggpanel layout --- */
.log-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: center;
    margin-bottom: 12px;
}
.log-toolbar-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    background: #23272b;
    border-radius: 6px;
    padding: 7px 12px;
    margin-right: 8px;
}
.log-toolbar-logs {
    background: #e3e7ef;
    border: 1px solid #b0b6c7;
}
.log-toolbar-actions {
    background: #fbe9e7;
    border: 1px solid #f8bbbc;
}
.log-toolbar-filters {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
}

.log-toolbar-btn {
    margin-bottom: 0;
    min-width: 110px;
}
.log-toolbar-btn-clear {
    background-color: #ea4335;
    color: #fff;
}

.log-toolbar-group label {
    margin-left: 10px;
    font-weight: 500;
    color: #444;
}

@media (max-width: 1000px) {
    .log-toolbar-row { flex-direction: column; gap: 8px; }
    .log-toolbar-group { width: 100%; margin-right: 0; justify-content: flex-start; }
    .log-toolbar-btn { min-width: 80px; }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .dashboard-cards {
        grid-template-columns: 1fr;
    }
    
    .search-filter {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-box {
        max-width: 100%;
    }
    
    .filter-form {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
}
