/* ============================================
   Parental Monitor - Admin Panel Styles
   Premium Bootstrap 5 Dashboard Theme
   ============================================ */

:root {
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --secondary: #94a3b8;
    --success: #34d399;
    --info: #38bdf8;
    --warning: #fbbf24;
    --danger: #f87171;
    --light: rgba(30, 41, 59, 0.4);
    --dark: #f8fafc;
    --sidebar-bg: rgba(15, 23, 42, 0.6);
    --sidebar-hover: rgba(255, 255, 255, 0.05);
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --border-radius: 1.2rem;
    --glass-border: rgba(255, 255, 255, 0.1);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', 'Segoe UI', 'Nunito', sans-serif;
    background: #0f172a;
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,1) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,1) 0, transparent 50%);
    color: #cbd5e1;
    min-height: 100vh;
}

/* ============================================
   Auth Pages (Login / Register)
   ============================================ */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f172a;
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,1) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,1) 0, transparent 50%);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

/* Floating animated background elements */
.auth-wrapper::before, .auth-wrapper::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(60px);
    z-index: 0;
    animation: authFloat 8s infinite alternate ease-in-out;
}

.auth-wrapper::before {
    background: rgba(99, 102, 241, 0.4);
    top: -50px;
    left: -50px;
}

.auth-wrapper::after {
    background: rgba(236, 72, 153, 0.4);
    bottom: -50px;
    right: -50px;
    animation-delay: -4s;
}

@keyframes authFloat {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, 30px) scale(1.1); }
}

.auth-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-width: 440px;
    width: 100%;
    padding: 2.5rem;
    position: relative;
    z-index: 1;
    animation: authFadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    color: #e2e8f0;
}

@keyframes authFadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-card .logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-card .logo i {
    font-size: 3rem !important;
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 6px rgba(129, 140, 248, 0.3));
    margin-bottom: 0.5rem;
    display: inline-block;
}

.auth-card .logo h2 {
    color: #f8fafc;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 0.25rem;
}

.auth-card .logo p {
    color: #94a3b8;
    font-size: 0.95rem;
}

/* Form Styles */
.auth-card .form-label {
    color: #cbd5e1;
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
}

.auth-card .input-group-text {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-right: none;
    color: #94a3b8;
    border-radius: 0.75rem 0 0 0.75rem;
    transition: all 0.3s ease;
}

.auth-card .form-control {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: none;
    color: #f8fafc;
    padding: 0.8rem 1rem;
    border-radius: 0 0.75rem 0.75rem 0;
    transition: all 0.3s ease;
}

.auth-card .form-control::placeholder {
    color: #64748b;
}

.auth-card .btn-outline-secondary {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: none;
    color: #94a3b8;
    border-radius: 0 0.75rem 0.75rem 0;
}

.auth-card .btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
}

.auth-card .input-group:focus-within .input-group-text,
.auth-card .input-group:focus-within .form-control,
.auth-card .input-group:focus-within .btn-outline-secondary {
    border-color: #818cf8;
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.1);
}

.auth-card .form-control:focus {
    background: rgba(15, 23, 42, 0.8);
    color: #fff;
}

.auth-card .form-check-label {
    color: #cbd5e1;
    font-size: 0.9rem;
}

.auth-card .form-check-input {
    background-color: rgba(15, 23, 42, 0.6);
    border-color: rgba(255, 255, 255, 0.2);
}

.auth-card .form-check-input:checked {
    background-color: #818cf8;
    border-color: #818cf8;
}

.auth-card .btn-primary {
    border-radius: 0.75rem;
    padding: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
    margin-top: 1rem;
    color: #fff;
}

.auth-card .btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
}

.auth-card .text-decoration-none {
    color: #818cf8;
    font-weight: 600;
    transition: color 0.3s ease;
}

.auth-card .text-decoration-none:hover {
    color: #c084fc;
}

/* Custom Alert Styles for Auth Card */
.auth-card .alert {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    border-left: 4px solid transparent;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.auth-card .alert-danger {
    border-left-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
}

.auth-card .alert-success {
    border-left-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
}

.auth-card .alert-info {
    border-left-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    color: #93c5fd;
}

.auth-card .alert-warning {
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    color: #fcd34d;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .auth-wrapper {
        padding: 1rem;
    }
    .auth-card {
        padding: 2rem 1.5rem;
        border-radius: 1.2rem;
    }
    .auth-card .logo h2 {
        font-size: 1.5rem;
    }
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    width: 260px;
    height: 100vh;
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.sidebar .sidebar-brand {
    padding: 1.5rem;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 800;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar .sidebar-brand i {
    font-size: 1.75rem;
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar .nav-item {
    margin: 4px 12px;
}

.sidebar .nav-link {
    color: #94a3b8;
    padding: 0.85rem 1.25rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.sidebar .nav-link:hover, .sidebar .nav-link.active {
    background: var(--sidebar-hover);
    color: #f8fafc;
    transform: translateX(4px);
}

.sidebar .nav-link.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
    border: 1px solid rgba(129, 140, 248, 0.2);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    color: #818cf8;
}

.sidebar .nav-link i {
    font-size: 1.15rem;
    width: 24px;
    text-align: center;
    transition: transform 0.3s ease;
}

.sidebar .nav-link:hover i {
    transform: scale(1.1);
}

.sidebar .nav-section {
    color: #64748b;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 1.5rem 1.5rem 0.75rem;
    font-weight: 700;
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
    transition: all 0.3s;
}

.topbar {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar .page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
    letter-spacing: -0.5px;
}

.topbar .user-menu {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.topbar .notification-badge {
    position: relative;
    cursor: pointer;
    color: #94a3b8;
    font-size: 1.25rem;
    transition: color 0.3s ease;
}

.topbar .notification-badge:hover {
    color: var(--primary);
}

.topbar .notification-badge .badge {
    position: absolute !important;
    top: -4px !important;
    right: -6px !important;
    left: auto !important;
    transform: none !important;
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    min-width: 16px !important;
    height: 16px !important;
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1.5px solid #0f172a !important;
    padding: 0 4px !important;
    box-sizing: border-box !important;
}

.topbar .notification-badge .badge.bg-danger {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%) !important;
    color: #fff !important;
}

.topbar .notification-badge .badge.bg-warning {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%) !important;
    color: #0f172a !important;
}

.content-area {
    padding: 1.5rem;
}

/* ============================================
   Dashboard Cards
   ============================================ */
.stat-card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    border-radius: 4px 0 0 4px;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
    background: rgba(30, 41, 59, 0.8);
}

.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary);
    border: 1px solid rgba(255,255,255,0.05);
}

.stat-card .stat-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--dark);
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
}

.stat-card.border-primary::before { background: var(--primary); }
.stat-card.border-success::before { background: var(--success); }
.stat-card.border-info::before { background: var(--info); }
.stat-card.border-warning::before { background: var(--warning); }
.stat-card.border-danger::before { background: var(--danger); }

.stat-card.border-primary .stat-icon { color: var(--primary); }
.stat-card.border-success .stat-icon { color: var(--success); }
.stat-card.border-info .stat-icon { color: var(--info); }
.stat-card.border-warning .stat-icon { color: var(--warning); }
.stat-card.border-danger .stat-icon { color: var(--danger); }

/* ============================================
   Data Cards
   ============================================ */
.data-card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.data-card:hover {
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
    background: rgba(30, 41, 59, 0.7);
}

.data-card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--glass-border);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.data-card .card-header h5 {
    margin: 0;
    font-weight: 700;
    color: var(--dark);
    font-size: 1.1rem;
}

.data-card .card-body {
    padding: 1.5rem;
}

/* ============================================
   Device Cards
   ============================================ */
.device-card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    height: 100%;
}

.device-card:hover {
    border-color: rgba(129, 140, 248, 0.5);
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
}

.device-card .device-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.device-card .device-name {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--dark);
    margin-top: 0.5rem;
}

.device-card .device-model {
    font-size: 0.9rem;
    color: var(--secondary);
}

.device-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.35rem 0.85rem;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.device-status.online {
    background: rgba(52, 211, 153, 0.15);
    color: var(--success);
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.device-status.offline {
    background: rgba(148, 163, 184, 0.15);
    color: var(--secondary);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.device-status.pending {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
    border: 1px solid rgba(251, 191, 36, 0.2);
}

/* ============================================
   Pair Code Display
   ============================================ */
.pair-code-display {
    text-align: center;
    padding: 2.5rem;
}

.pair-code-display .code {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: 16px;
    color: #fff;
    background: rgba(15, 23, 42, 0.5);
    padding: 1.5rem 2.5rem;
    border-radius: 1.5rem;
    display: inline-block;
    border: 2px dashed rgba(129, 140, 248, 0.5);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

.pair-code-display .timer {
    font-size: 1.2rem;
    color: var(--danger);
    margin-top: 1.5rem;
    font-weight: 700;
}

/* ============================================
   Approval Modal
   ============================================ */
.approval-device-info {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.approval-device-info .info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.approval-device-info .info-row:last-child {
    border-bottom: none;
}

.approval-device-info .info-label {
    color: var(--secondary);
    font-weight: 500;
}

.approval-device-info .info-value {
    font-weight: 600;
    color: var(--dark);
}

/* ============================================
   Permission Status
   ============================================ */
.permission-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
}

.permission-badge.on {
    background: rgba(52, 211, 153, 0.15);
    color: var(--success);
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.permission-badge.off {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

/* ============================================
   Tables
   ============================================ */
.table {
    color: #e2e8f0;
}

.table-responsive {
    border-radius: 0.75rem;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid var(--glass-border);
}

.table th {
    background: rgba(15, 23, 42, 0.6) !important;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--secondary) !important;
    border-bottom: 1px solid var(--glass-border) !important;
    padding: 1rem 1.5rem !important;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
    font-size: 0.95rem;
    padding: 1rem 1.5rem !important;
    border-bottom: 1px solid rgba(255,255,255,0.05) !important;
    background: transparent !important;
}

.table tbody tr:hover td {
    background: rgba(255,255,255,0.02) !important;
}

/* ============================================
   Modals & Globals
   ============================================ */
.modal-content {
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    color: #e2e8f0;
}

.modal-header {
    border-bottom: 1px solid var(--glass-border);
}

.modal-footer {
    border-top: 1px solid var(--glass-border);
}

.btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.text-muted {
    color: var(--secondary) !important;
}

.form-control, .form-select {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    color: #f8fafc;
}

.form-control:focus, .form-select:focus {
    background: rgba(15, 23, 42, 0.8);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.1);
}

.text-dark {
    color: #f8fafc !important;
}

/* ============================================
   Loading Spinner
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #eee;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fade-in {
    animation: fadeInUp 0.4s ease;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        width: 0;
        overflow: hidden !important;
    }

    .sidebar.show {
        width: 260px;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        height: 100vh;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 3rem;
    }

    .main-content {
        margin-left: 0;
    }

    .topbar .menu-toggle {
        display: block !important;
    }

    .stat-card .stat-value {
        font-size: 1.25rem;
    }

    .pair-code-display .code {
        font-size: 2rem;
        letter-spacing: 8px;
        padding: 0.75rem 1.5rem;
    }

    .content-area {
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    .auth-card {
        padding: 1.5rem;
    }

    .topbar {
        padding: 0.5rem 1rem;
    }
}

/* ============================================
   Utility Classes
   ============================================ */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer { cursor: pointer; }

.transition-all {
    transition: all 0.3s ease;
}

.battery-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.battery-indicator.low { color: var(--danger); }
.battery-indicator.medium { color: var(--warning); }
.battery-indicator.high { color: var(--success); }

/* Sidebar toggle button */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--dark);
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
}
