/**
 * Admin Backend - Custom Styles
 */

/* ===== Variables ===== */
:root {
    --sidebar-width: 250px;
    --navbar-height: 56px;
    --primary-color: #0d6efd;
    --sidebar-bg: #212529;
    --sidebar-text: #adb5bd;
    --sidebar-active: #0d6efd;
}

/* ===== Global ===== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    overflow-x: hidden;
}

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

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

.login-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, #2c5282 0%, #1a365d 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.login-header i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.login-header h3 {
    margin-bottom: 0.5rem;
}

.login-header p {
    margin-bottom: 0;
    opacity: 0.9;
}

.login-body {
    padding: 2rem;
}

.login-footer {
    background: #f8f9fa;
    padding: 1rem;
    text-align: center;
}

/* ===== Navbar ===== */
.navbar {
    height: var(--navbar-height);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-weight: 600;
}

/* ===== Sidebar ===== */
.wrapper {
    display: flex;
    margin-top: var(--navbar-height);
}

.sidebar {
    width: var(--sidebar-width);
    min-height: calc(100vh - var(--navbar-height));
    background: var(--sidebar-bg);
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    z-index: 100;
    transition: all 0.3s;
    overflow-y: auto;
}

.sidebar.collapsed {
    margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-content {
    padding: 1rem 0;
}

.sidebar-user {
    padding: 1rem;
    text-align: center;
}

.sidebar-user img,
.sidebar-user .avatar-placeholder {
    margin-bottom: 0.5rem;
}

.avatar-placeholder {
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.sidebar-user .user-info h6 {
    color: white;
    margin-bottom: 0.25rem;
}

.sidebar-divider {
    border-color: rgba(255, 255, 255, 0.1);
    margin: 0.5rem 1rem;
}

.sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar .nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar .nav-link.active {
    color: white;
    background: rgba(13, 110, 253, 0.2);
    border-left-color: var(--primary-color);
}

.sidebar .nav-link i.fa-chevron-down {
    transition: transform 0.2s;
}

.sidebar .nav-link.collapsed i.fa-chevron-down {
    transform: rotate(-90deg);
}

.sidebar .submenu {
    background: rgba(0, 0, 0, 0.2);
}

.sidebar .submenu .nav-link {
    padding-left: 2.5rem;
    font-size: 0.9rem;
}

.sidebar-footer {
    padding: 1rem;
    text-align: center;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 1.5rem;
    transition: margin-left 0.3s;
    min-height: calc(100vh - var(--navbar-height));
}

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

/* ===== Page Header ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0;
}

.breadcrumb {
    margin-bottom: 0;
    background: transparent;
    padding: 0;
}

/* ===== Cards ===== */
.card {
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
}

.card-header {
    background: white;
    border-bottom: 1px solid #eee;
    font-weight: 600;
}

/* ===== Stats Cards ===== */
.stat-card {
    border-radius: 10px;
    overflow: hidden;
}

.stat-card .card-body {
    padding: 1.5rem;
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: bold;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* ===== Tables ===== */
.table th {
    font-weight: 600;
    background: #f8f9fa;
    border-bottom-width: 1px;
}

.table td {
    vertical-align: middle;
}

.table .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.table .avatar-sm {
    width: 32px;
    height: 32px;
}

/* ===== Badges ===== */
.badge-role {
    font-weight: 500;
    padding: 0.4em 0.8em;
}

/* ===== Forms ===== */
.form-label {
    font-weight: 500;
}

.required::after {
    content: " *";
    color: #dc3545;
}

/* ===== Action Buttons ===== */
.btn-action {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* ===== Permissions Checkboxes ===== */
.permission-group {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.permission-group-header {
    background: #f8f9fa;
    padding: 0.75rem 1rem;
    font-weight: 600;
    border-bottom: 1px solid #dee2e6;
}

.permission-group-body {
    padding: 1rem;
}

.permission-item {
    padding: 0.5rem 0;
}

/* ===== Responsive ===== */
@media (max-width: 991.98px) {
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    
    .sidebar.collapsed {
        margin-left: 0;
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* ===== Utilities ===== */
.cursor-pointer {
    cursor: pointer;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== DataTables Custom ===== */
.dataTables_wrapper .dataTables_filter input {
    border-radius: 20px;
    padding-left: 15px;
}

.dataTables_wrapper .dataTables_length select {
    border-radius: 5px;
}

/* ===== Activity Log ===== */
.activity-item {
    padding: 1rem;
    border-left: 3px solid #0d6efd;
    background: #f8f9fa;
    margin-bottom: 0.5rem;
    border-radius: 0 5px 5px 0;
}

.activity-item.login {
    border-left-color: #198754;
}

.activity-item.logout {
    border-left-color: #6c757d;
}

.activity-item.create {
    border-left-color: #0d6efd;
}

.activity-item.update {
    border-left-color: #ffc107;
}

.activity-item.delete {
    border-left-color: #dc3545;
}
