/* =========================
   Base
========================= */
html,
body {
    min-height: 100%;
}

body {
    min-height: 100vh;
    background: #f5f7fb;
    overflow-x: hidden;
    color: #212529;
}

/* =========================
   Auth Page
========================= */
.auth-page {
    min-height: 100vh;
    padding: 24px 12px;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

/* =========================
   Logo
========================= */
.auth-logo {
    max-height: 70px;
    width: auto;
    max-width: 100%;
}

.auth-logo-wrapper {
    margin-bottom: 1.5rem;
}

/* Password toggle button */
#togglePassword {
    min-width: 45px;
}

/* =========================
   General Elements
========================= */
img {
    max-width: 100%;
    height: auto;
}

.card {
    border: 0;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #eef1f6;
    border-top-left-radius: 18px !important;
    border-top-right-radius: 18px !important;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.alert {
    border: 0;
    border-radius: 14px;
    word-wrap: break-word;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}

.btn,
.form-control,
.form-select {
    min-height: 30px;
    border-radius: 6px;
}

.form-control,
.form-select {
    border-color: #dbe2ea;
}

.form-control:focus,
.form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.12);
}

/* =========================
   Dashboard Wrapper
========================= */
#dashboard-wrapper {
    min-height: 100vh;
}

/* =========================
   Dashboard Topbar
========================= */
.dashboard-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: 64px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e9eef5;
}

.dashboard-topbar-inner {
    position: relative;
    min-height: 64px;
}

.topbar-left,
.topbar-right {
    width: 170px;
    z-index: 2;
}

.topbar-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
}

.topbar-logo-link {
    min-height: 44px;
}

.topbar-logo {
    height: 40px;
    width: auto;
    max-width: 100%;
}

.topbar-icon-btn,
.topbar-user-btn {
    border: none;
    box-shadow: none;
    color: #212529;
}

.topbar-icon-btn:hover,
.topbar-user-btn:hover,
.topbar-icon-btn:focus,
.topbar-user-btn:focus {
    color: #0d6efd;
    box-shadow: none;
}

.topbar-icon-btn,
.topbar-user-btn {
    min-height: 44px;
}

.topbar-user-btn {
    padding: 0.35rem 0.5rem !important;
    border-radius: 999px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.topbar-user-btn:hover {
    background-color: #f1f5f9;
}

.topbar-user-name {
    font-weight: 600;
    color: #212529;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =========================
   Sidebar Offcanvas
========================= */
.dashboard-sidebar-offcanvas {
    width: 320px;
    max-width: 85%;
    border-right: 1px solid #e9eef5;
}

.dashboard-sidebar-offcanvas .offcanvas-header {
    padding: 1rem 1.25rem;
    background: #ffffff;
}

.dashboard-sidebar-offcanvas .offcanvas-body {
    background: #ffffff;
}

.sidebar-logo {
    height: 36px;
    width: auto;
    max-width: 100%;
}

.dashboard-sidebar-offcanvas .accordion-item {
    border: 0;
    border-bottom: 1px solid #eef1f6;
    background: transparent;
}

.dashboard-sidebar-offcanvas .accordion-button {
    font-weight: 600;
    padding: 1rem 1.25rem;
    background-color: #fff;
    color: #1f2937;
    box-shadow: none;
}

.dashboard-sidebar-offcanvas .accordion-button:not(.collapsed) {
    background-color: #f8fbff;
    color: #0d6efd;
}

.dashboard-sidebar-offcanvas .accordion-button:focus {
    box-shadow: none;
    border-color: transparent;
}

.dashboard-sidebar-offcanvas .accordion-body {
    padding: 0.35rem 1.25rem 1rem;
    background-color: #fff;
}

.sidebar-submenu-link {
    display: block;
    padding: 0.7rem 0.2rem;
    color: #495057;
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.sidebar-submenu-link:hover {
    color: #0d6efd;
    background-color: #f8fbff;
    padding-left: 0.6rem;
}

/* =========================
   User Offcanvas
========================= */
.dashboard-user-offcanvas {
    width: 320px;
    max-width: 85%;
    border-left: 1px solid #e9eef5;
}

.dashboard-user-offcanvas .offcanvas-header {
    padding: 1rem 1.25rem;
    background: #ffffff;
}

.dashboard-user-offcanvas .offcanvas-body {
    background: #ffffff;
}

.user-panel-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d6efd, #0b5ed7);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 8px 20px rgba(13, 110, 253, 0.18);
}

.dashboard-user-menu li + li {
    margin-top: 0.35rem;
}

.dashboard-user-menu-link {
    display: flex;
    align-items: center;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    color: #212529;
    text-decoration: none;
    transition: all 0.2s ease;
}

.dashboard-user-menu-link:hover {
    background-color: #f8fbff;
    color: #0d6efd;
    transform: translateX(2px);
}

/* =========================
   Dashboard Main Content
========================= */
.dashboard-main-content {
    min-height: calc(100vh - 64px);
}

.dashboard-main-content .container-fluid {
    max-width: 1600px;
}

.dashboard-page-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: #111827;
}

.dashboard-section {
    margin-bottom: 1.5rem;
}

/* =========================
   Dashboard Helpers
========================= */
.dashboard-surface {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.dashboard-muted {
    color: #6b7280;
}

/* =========================
   Responsive - Tablet
========================= */
@media (max-width: 991.98px) {
    .auth-page {
        padding: 20px 14px;
    }

    .auth-container {
        max-width: 460px;
    }

    .topbar-left,
    .topbar-right {
        width: 140px;
    }
}

/* =========================
   Responsive - Mobile
========================= */
@media (max-width: 767.98px) {
    body {
        background: #f5f7fb;
    }

    .auth-page {
        min-height: 100vh;
        padding: 16px;
    }

    .auth-container {
        max-width: 100%;
    }

    .auth-logo {
        max-height: 56px;
    }

    .auth-logo-wrapper {
        margin-bottom: 1rem;
    }

    .card {
        border-radius: 14px;
    }

    .container,
    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }

    .dashboard-topbar {
        height: 58px;
    }

    .dashboard-topbar-inner {
        min-height: 58px;
    }

    .topbar-left,
    .topbar-right {
        width: auto;
    }

    .topbar-logo {
        height: 34px;
    }

    .topbar-user-name {
        display: none;
    }

    .dashboard-main-content {
        min-height: calc(100vh - 58px);
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    .alert {
        font-size: 0.95rem;
    }
}

/* =========================
   Responsive - Small Mobile
========================= */
@media (max-width: 575.98px) {
    .auth-page {
        padding: 12px;
    }

    .auth-logo {
        max-height: 50px;
    }

    .card {
        border-radius: 12px;
    }

    .btn,
    .form-control,
    .form-select {
        font-size: 0.7rem;
    }

    .dashboard-sidebar-offcanvas,
    .dashboard-user-offcanvas {
        width: 290px;
    }

    .sidebar-logo {
        height: 32px;
    }

    .topbar-logo {
        height: 30px;
    }

    .user-panel-avatar {
        width: 46px;
        height: 46px;
        font-size: 1rem;
    }
}

/* =========================
   Dashboard Stats
========================= */
.dashboard-stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

@media (max-width: 575.98px) {
    .dashboard-stat-icon {
        width: 46px;
        height: 46px;
        font-size: 1rem;
        border-radius: 12px;
    }
}

/* =========================
   Coming Soon Page
========================= */
.coming-soon-icon {
    width: 88px;
    height: 88px;
    border-radius: 24px;
    background: linear-gradient(135deg, #0d6efd, #0b5ed7);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 14px 30px rgba(13, 110, 253, 0.2);
}

@media (max-width: 575.98px) {
    .coming-soon-icon {
        width: 72px;
        height: 72px;
        border-radius: 20px;
        font-size: 1.6rem;
    }
}

.sidebar-submenu-link.active {
    color: #0d6efd;
    background-color: #f0f7ff;
    font-weight: 600;
    padding-left: 0.75rem;
}

.dashboard-user-menu-link.active {
    background-color: #f0f7ff;
    color: #0d6efd;
    font-weight: 600;
}

/* =========================================================
   HISTORY PAGE
========================================================= */

.history-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.history-page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
}

.history-page-subtitle {
    color: #6b7280;
    font-size: 0.95rem;
}

.history-summary-card {
    border-radius: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.history-summary-card:hover {
    transform: translateY(-2px);
}

.history-summary-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.history-summary-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    color: #111827;
    margin-bottom: 0.5rem;
}

.history-summary-value-sm {
    font-size: 1.1rem;
    word-break: break-word;
}

.history-summary-note {
    font-size: 0.875rem;
    color: #6b7280;
}

.history-table-card {
    border-radius: 1rem;
}

.history-empty-state {
    padding: 3rem 1.5rem;
    border: 1px dashed #d1d5db;
    border-radius: 1rem;
    background: #f9fafb;
}

.history-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef2ff;
    color: #4f46e5;
    font-size: 1.5rem;
}

.history-table thead th {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6b7280;
    background-color: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.history-table tbody td {
    vertical-align: middle;
    border-color: #eef2f7;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.history-table tbody tr:hover {
    background-color: #fafbff;
}

.history-row-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 0.5rem;
    border-radius: 999px;
    background: #f3f4f6;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.history-ip-badge {
    display: inline-block;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.875rem;
    font-weight: 600;
}

.history-user-agent-cell {
    min-width: 320px;
    max-width: 520px;
}

.history-user-agent-text {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
    word-break: break-word;
}

@media (max-width: 767.98px) {
    .history-page-title {
        font-size: 1.5rem;
    }

    .history-summary-value {
        font-size: 1.5rem;
    }

    .history-summary-value-sm {
        font-size: 1rem;
    }

    .history-empty-state {
        padding: 2rem 1rem;
    }

    .history-user-agent-cell {
        min-width: 240px;
    }
}

.history-device-main {
    font-weight: 600;
    color: #111827;
    font-size: 0.9rem;
}

.history-device-raw {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 2px;
    word-break: break-word;
}

.history-row-current {
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.06) 0%, rgba(79, 70, 229, 0.02) 100%);
}

.history-security-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.history-flag {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.45rem 0.7rem;
    border: 1px solid transparent;
}

.history-flag-current {
    background: #eef2ff;
    color: #4338ca;
    border-color: #c7d2fe;
}

.history-flag-ip {
    background: #fff7ed;
    color: #c2410c;
    border-color: #fdba74;
}

.history-flag-device {
    background: #ecfeff;
    color: #0f766e;
    border-color: #99f6e4;
}

.history-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.history-filter-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #4b5563;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.history-filter-chip:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #111827;
}

.history-filter-chip.active {
    background: #111827;
    color: #ffffff;
    border-color: #111827;
}

.history-pagination-wrap {
    border-top: 1px solid #eef2f7;
    padding-top: 1rem;
}

.history-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.history-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.9rem;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.history-page-link:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #111827;
}

.history-page-link.active {
    background: #111827;
    color: #ffffff;
    border-color: #111827;
}

.history-page-link.disabled {
    pointer-events: none;
    opacity: 0.45;
}

.history-page-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    color: #9ca3af;
    font-weight: 700;
}

@media (max-width: 767.98px) {
    .history-filter-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .history-pagination {
        gap: 0.4rem;
    }

    .history-page-link {
        min-width: 36px;
        height: 36px;
        padding: 0 0.75rem;
        font-size: 0.82rem;
    }
}

/* Topbar last login */
.topbar-last-login {
    font-size: 0.75rem;
    margin-top: 2px;
}

/* User panel last login */
.user-panel-last-login {
    padding: 0.75rem 0.75rem;
    border: 1px solid #eef2f7;
    border-radius: 0.75rem;
    background: #f9fafb;
}

.user-panel-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.user-panel-last-login-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.user-panel-last-login-item .label {
    color: #6b7280;
}

.user-panel-last-login-item .value {
    font-weight: 600;
    color: #111827;
}

.login-alert-banner {
    margin: 0.75rem 1rem 0;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: #fff7ed;
    border: 1px solid #fdba74;
}

.login-alert-content {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.login-alert-icon {
    font-size: 1.2rem;
}

.login-alert-text {
    font-size: 0.85rem;
    color: #7c2d12;
    line-height: 1.4;
}


.table-action-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-action-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    line-height: 1;
}

.btn-action-icon i {
    font-size: 14px;
    line-height: 1;
}

.btn-action-icon:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}