/* Base Styles & Variables */
:root {
    --bg-dark: #0f111a;
    --bg-card: #1e2130;
    --text-primary: #f8f9fa;
    --text-secondary: #adb5bd;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --success: #10b981;
    --danger: #ef4444;
    --border-color: rgba(255, 255, 255, 0.08);
    --sidebar-width: 260px;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar-header {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

.bot-status-container {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.header-status #app-version-info {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.6;
    margin-left: 8px;
    margin-top: 0;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    transition: background-color 0.3s;
}

.status-indicator.connected {
    background-color: var(--success);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-header {
    height: 70px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(15, 17, 26, 0.8);
    backdrop-filter: blur(10px);
    z-index: 20;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.header-divider {
    height: 32px;
    width: 1px;
    background: var(--border-color);
}

#header-user {
    display: flex;
    align-items: center;
}

.user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.user-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

#header-username {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}

.user-bottom {
    display: flex;
    align-items: center;
    gap: 12px;
}

.session-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: var(--danger);
    text-decoration: none;
    transition: opacity 0.2s;
    cursor: pointer;
    font-weight: 600;
}

#btn-logout:hover {
    opacity: 0.8;
}

.filter-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

select, input[type="date"] {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
    font-size: 0.875rem;
}

input[type="date"] {
    color-scheme: dark;
}

/* Views */
.view-section {
    display: none;
    padding: 32px;
    overflow-y: auto;
    height: calc(100vh - 70px);
    animation: fadeIn 0.3s ease;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cards */
.card {
    background-color: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

.card-body.p-0 {
    padding: 0;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background-color: rgba(255, 255, 255, 0.02);
}

.data-table td {
    font-size: 0.875rem;
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.data-table th.sortable:hover {
    color: var(--accent-blue);
}

.data-table th.sortable span {
    font-size: 0.8em;
    margin-left: 4px;
    color: var(--text-secondary);
}

.data-table tbody tr {
    transition: background-color 0.2s;
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Badges & Pills */
.badge {
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge.active {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.badge.inactive {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* Buttons */
.btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-toggle {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-card {
    background-color: var(--bg-card);
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.modal-card h2 {
    margin-bottom: 12px;
}

.modal-card p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 0.875rem;
}

.qr-code-placeholder {
    width: 250px;
    height: 250px;
    margin: 0 auto;
    background-color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 16px;
}

.qr-code-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(59, 130, 246, 0.3);
    border-radius: 50%;
    border-top-color: var(--accent-blue);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.text-muted {
    color: var(--text-secondary);
}

/* Integrated Login Modal Styles */
#main-wrapper.blurred {
    filter: blur(15px);
    pointer-events: none;
    transition: filter 0.5s ease;
}

.login-modal-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 10;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.login-modal-card .brand-section {
    text-align: center;
    margin-bottom: 2rem;
}

.login-modal-card .brand-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.login-modal-card h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #60a5fa, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-modal-card .form-group {
    margin-bottom: 1.5rem;
}

.login-modal-card label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.login-modal-card input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: white;
    outline: none;
    transition: border-color 0.2s;
}

.login-modal-card input:focus {
    border-color: var(--accent-blue);
}

.login-bg-blobs {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 1;
}

.login-bg-blobs .blob {
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.2;
    animation: drift 10s infinite alternate;
}

.login-bg-blobs .blob-1 {
    background: var(--accent-blue);
    top: -100px;
    left: -100px;
}

.login-bg-blobs .blob-2 {
    background: #ec4899;
    bottom: -100px;
    right: -100px;
    animation-delay: -5s;
}

@keyframes drift {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(50px, 30px) scale(1.1); }
}

.w-100 { width: 100%; }
.spinner-sm {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.hidden { display: none !important; }
.error-text {
    margin-top: 1rem;
    color: var(--danger);
    font-size: 0.85rem;
    text-align: center;
}

/* Pagination Styles */
.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.01);
}

.pagination-controls .page-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 80px;
    text-align: center;
}

.btn-pagination {
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-pagination:hover:not(:disabled) {
    background-color: var(--border-color);
    border-color: var(--text-secondary);
}

.w-100 {
    width: 100% !important;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.btn-primary {
    background-color: var(--accent-blue);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-blue-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}