/* Custom CSS for MmRemote Agent Web Interface */

/* =============================================================================
   CSS Variables
   ============================================================================= */
:root {
    --mmremote-primary: #0d6efd;
    --mmremote-success: #198754;
    --mmremote-danger: #dc3545;
    --mmremote-warning: #ffc107;
    --mmremote-info: #0dcaf0;
    
    /* Sidebar */
    --sidebar-bg: #1a1d23;
    --sidebar-width: 260px;
    --sidebar-header-height: 70px;
    --sidebar-footer-height: 100px;
    
    /* Top Bar */
    --topbar-height: 60px;
}

/* =============================================================================
   Sidebar Layout
   ============================================================================= */
body {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
}

/* Sidebar Header */
.sidebar-header {
    height: var(--sidebar-header-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
}

.sidebar-brand i {
    font-size: 1.5rem;
    color: var(--mmremote-primary);
}

/* Sidebar User */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.user-avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.user-avatar i {
    font-size: 1.5rem;
    color: #adb5bd;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role .badge {
    font-size: 0.65rem;
    padding: 0.15em 0.5em;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    padding: 0.25rem 1.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: #adb5bd;
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.nav-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: #fff;
    background: rgba(13, 110, 253, 0.15);
    border-left-color: var(--mmremote-primary);
}

.nav-item.active i {
    color: var(--mmremote-primary);
}

.nav-badge {
    margin-left: auto;
    font-size: 0.7rem;
    padding: 0.2em 0.5em;
}

/* Sidebar Footer */
.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1.25rem;
}

.sidebar-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #6c757d;
}

.stat-item i {
    font-size: 0.5rem;
}

.logout-link {
    color: #dc3545;
    border-left: none;
    border-radius: 4px;
    margin-top: 0.5rem;
}

.logout-link:hover {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
}

/* =============================================================================
   Main Content Area
   ============================================================================= */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top Bar */
.top-bar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
}

.sidebar-toggle {
    display: none;
    padding: 0.5rem;
    font-size: 1.5rem;
    color: #495057;
}

.breadcrumb-container {
    flex: 1;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #6c757d;
    font-size: 0.85rem;
}

/* Content Wrapper */
.content-wrapper {
    flex: 1;
    padding: 1.5rem;
    background: #f8f9fa;
}

/* =============================================================================
   Cards & Statistics
   ============================================================================= */
.card {
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: none;
    transition: box-shadow 0.2s ease;
}

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

.card.border-primary { border-left: 4px solid var(--mmremote-primary) !important; }
.card.border-success { border-left: 4px solid var(--mmremote-success) !important; }
.card.border-warning { border-left: 4px solid var(--mmremote-warning) !important; }
.card.border-info { border-left: 4px solid var(--mmremote-info) !important; }

/* Stat Cards */
.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-card-icon.bg-primary { background: rgba(13, 110, 253, 0.1); color: var(--mmremote-primary); }
.stat-card-icon.bg-success { background: rgba(25, 135, 84, 0.1); color: var(--mmremote-success); }
.stat-card-icon.bg-warning { background: rgba(255, 193, 7, 0.1); color: var(--mmremote-warning); }
.stat-card-icon.bg-danger { background: rgba(220, 53, 69, 0.1); color: var(--mmremote-danger); }
.stat-card-icon.bg-info { background: rgba(13, 202, 240, 0.1); color: var(--mmremote-info); }

.stat-card-content h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #212529;
}

.stat-card-content p {
    margin: 0;
    font-size: 0.8rem;
    color: #6c757d;
}

/* =============================================================================
   Tables
   ============================================================================= */
.table {
    margin-bottom: 0;
}

.table thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: #6c757d;
    border-bottom: 2px solid #dee2e6;
    padding: 0.75rem 1rem;
}

.table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.03);
}

/* =============================================================================
   Buttons
   ============================================================================= */
.btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 0.5rem 1rem;
}

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

.btn-primary:hover {
    background: #0b5ed7;
    border-color: #0a58ca;
}

/* =============================================================================
   Badges
   ============================================================================= */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* =============================================================================
   Alerts
   ============================================================================= */
.alert {
    border-radius: 6px;
    margin-bottom: 0;
}

/* =============================================================================
   Forms
   ============================================================================= */
.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-control, .form-select {
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
}

.input-group-text {
    background-color: #f8f9fa;
    border-right: none;
    border-radius: 6px 0 0 6px;
}

.input-group .form-control {
    border-left: none;
    border-radius: 0 6px 6px 0;
}

.input-group .form-control:focus {
    border-color: #ced4da;
    box-shadow: none;
}

/* =============================================================================
   Quick Actions Grid
   ============================================================================= */
.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    color: #495057;
    background: #fff;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
}

.quick-action-btn i {
    font-size: 1.5rem;
}

.quick-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--mmremote-primary);
    color: var(--mmremote-primary);
}

/* =============================================================================
   Login Page
   ============================================================================= */
.login-container {
    min-height: calc(100vh - 4rem);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =============================================================================
   Status Indicators
   ============================================================================= */
.status-online { color: var(--mmremote-success); }
.status-offline { color: #6c757d; }
.status-pending { color: var(--mmremote-warning); }
.status-blocked { color: var(--mmremote-danger); }

/* =============================================================================
   Responsive Design
   ============================================================================= */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .content-wrapper {
        padding: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-card-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .stat-card-content h3 {
        font-size: 1.25rem;
    }
}

@media (max-width: 575.98px) {
    .top-bar {
        padding: 0 1rem;
    }
    
    .top-bar-actions {
        display: none;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.5rem 0.75rem;
    }
}

/* =============================================================================
   Icons in tables
   ============================================================================= */
.table i.bi {
    margin-right: 4px;
}

/* =============================================================================
   Pagination
   ============================================================================= */
.pagination {
    margin-top: 1.5rem;
}

.page-link {
    border-radius: 4px;
    margin: 0 2px;
}

/* =============================================================================
   Scrollbar styling
   ============================================================================= */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* =============================================================================
   Login Page — Full-screen with gradient background
   ============================================================================= */
.login-page {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.login-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 40%, #0d6efd 100%);
    z-index: -1;
}

.login-bg::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 70%, rgba(13, 110, 253, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 70% 30%, rgba(13, 202, 240, 0.1) 0%, transparent 50%);
    animation: bgShift 20s ease-in-out infinite alternate;
}

@keyframes bgShift {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(-5%, -3%); }
}

.login-card-wrapper {
    width: 100%;
    max-width: 440px;
    padding: 1rem;
}

.login-card {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.97);
}

.login-icon-wrapper {
    width: 72px;
    height: 72px;
    margin: 0 auto;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d6efd, #0b5ed7);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(13, 110, 253, 0.3);
}

.login-icon-wrapper i {
    font-size: 2rem;
    color: #fff;
}

.login-btn {
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 10px;
    background: linear-gradient(135deg, #0d6efd, #0b5ed7);
    border: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(13, 110, 253, 0.4);
    background: linear-gradient(135deg, #0b5ed7, #0a58ca);
}

.login-btn:active {
    transform: translateY(0);
}

.login-card .input-group-lg .input-group-text {
    border-radius: 10px 0 0 10px;
    padding: 0.75rem 1rem;
}

.login-card .input-group-lg .form-control {
    border-radius: 0 10px 10px 0;
    padding: 0.75rem 0.75rem;
    font-size: 0.95rem;
}

.login-card .input-group-lg .form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.login-card .form-label {
    font-size: 0.9rem;
    color: #495057;
}

/* =============================================================================
   Error Pages (404 / 500)
   ============================================================================= */
.error-code {
    font-size: 6rem;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, #0d6efd, #0b5ed7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.05em;
}

.error-icon-wrapper {
    width: 64px;
    height: 64px;
    margin: 0 auto;
    border-radius: 50%;
    background: rgba(13, 110, 253, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-icon-wrapper i {
    font-size: 1.75rem;
    color: #0d6efd;
}

.error-icon-danger {
    background: rgba(220, 53, 69, 0.1);
}

.error-icon-danger i {
    color: #dc3545;
}
