/* Bootstrap Custom Theme for Parental Control App */

:root {
    --bs-primary: #4f46e5;
    --bs-primary-rgb: 79, 70, 229;
    --bs-secondary: #6b7280;
    --bs-success: #10b981;
    --bs-danger: #ef4444;
    --bs-warning: #f59e0b;
    --bs-info: #3b82f6;
    --bs-light: #f9fafb;
    --bs-dark: #1f2937;

    --bs-body-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-body-line-height: 1.6;

    /* Custom variables */
    --sidebar-width: 280px;
    --header-height: 70px;
}

/* Dark mode colors */
[data-bs-theme="dark"] {
    --bs-body-bg: #111827;
    --bs-body-color: #f9fafb;
    --bs-border-color: #374151;
}

/* ===== Global Enhancements ===== */
body {
    font-size: 0.95rem;
}

.app-container {
    min-height: 100vh;
}

/* ===== Sidebar Styling ===== */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #4f46e5 0%, #6366f1 100%);
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.1);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

[data-bs-theme="dark"] .sidebar {
    background: linear-gradient(180deg, #1e293b 0%, #334155 100%);
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.5);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.sidebar-header p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    margin: 0.25rem 0 0 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: rgba(255, 255, 255, 0.5);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left-color: white;
    font-weight: 500;
}

.nav-item span {
    margin-right: 0.75rem;
    font-size: 1.25rem;
}

/* ===== Main Content Area ===== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: #f9fafb;
}

[data-bs-theme="dark"] .main-content {
    background: #111827;
}

.page-header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 1.5rem 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] .page-header {
    background: #1f2937;
    border-bottom-color: #374151;
}

/* ===== Cards Enhancement ===== */
.card {
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-bs-theme="dark"] .card {
    background: #1f2937;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.child-card {
    border-left: 4px solid var(--bs-primary);
}

.device-card {
    border-left: 4px solid var(--bs-info);
}

/* ===== Status Badges ===== */
.status-online {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.status-online::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bs-success);
    box-shadow: 0 0 8px var(--bs-success);
    animation: pulse 2s infinite;
}

.status-offline::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bs-secondary);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ===== Buttons Enhancement ===== */
.btn {
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--bs-primary) 0%, #6366f1 100%);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

/* ===== Forms Enhancement ===== */
.form-control,
.form-select {
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    padding: 0.625rem 0.875rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.25);
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

/* ===== Toggle Switch (Bootstrap Form Switch) ===== */
.form-check-input {
    width: 3rem;
    height: 1.5rem;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

/* ===== Modal Enhancement ===== */
.modal-content {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    border-bottom: 1px solid #e5e7eb;
    padding: 1.5rem;
}

[data-bs-theme="dark"] .modal-content {
    background: #1f2937;
}

[data-bs-theme="dark"] .modal-header {
    border-bottom-color: #374151;
}

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

[data-bs-theme="dark"] .login-page {
    background: linear-gradient(135deg, #1e3a8a 0%, #581c87 100%);
}

.login-card {
    max-width: 450px;
    border: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border-radius: 1rem;
}

.logo h1 {
    color: var(--bs-primary);
    font-weight: 700;
}

/* ===== Pairing Code Display ===== */
.pairing-code {
    font-size: 3rem;
    font-weight: 700;
    color: var(--bs-primary);
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5rem;
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border-radius: 0.75rem;
    border: 2px dashed var(--bs-primary);
}

[data-bs-theme="dark"] .pairing-code {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-color: #6366f1;
}

/* ===== Table Enhancement ===== */
.table {
    border-radius: 0.5rem;
    overflow: hidden;
}

.table thead th {
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

[data-bs-theme="dark"] .table thead th {
    background: #1f2937;
    border-bottom-color: #374151;
}

.table tbody tr:hover {
    background: #f9fafb;
}

[data-bs-theme="dark"] .table tbody tr:hover {
    background: #1f2937;
}

/* ===== Alert Enhancement ===== */
.alert {
    border: none;
    border-radius: 0.75rem;
    border-left: 4px solid;
}

.alert-success {
    border-left-color: var(--bs-success);
    background: #ecfdf5;
    color: #065f46;
}

.alert-danger {
    border-left-color: var(--bs-danger);
    background: #fef2f2;
    color: #991b1b;
}

[data-bs-theme="dark"] .alert-success {
    background: #064e3b;
    color: #d1fae5;
}

[data-bs-theme="dark"] .alert-danger {
    background: #7f1d1d;
    color: #fecaca;
}

/* ===== Dark Mode Toggle Button ===== */
.dark-mode-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: white;
    border: 2px solid #e5e7eb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1040;
    font-size: 1.5rem;
}

.dark-mode-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

[data-bs-theme="dark"] .dark-mode-toggle {
    background: #1f2937;
    border-color: #374151;
}

/* Sidebar toggle for pages with nav */
.sidebar .dark-mode-toggle {
    position: relative;
    bottom: auto;
    right: auto;
    width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 0.5rem 1rem;
    padding: 0.75rem;
    justify-content: flex-start;
    gap: 0.75rem;
}

/* ===== Responsive Design ===== */
@media (max-width: 991.98px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

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

    .sidebar-nav {
        display: flex;
        overflow-x: auto;
        padding: 0;
    }

    .nav-item {
        flex-shrink: 0;
        border-left: none;
        border-bottom: 3px solid transparent;
    }

    .nav-item.active,
    .nav-item:hover {
        border-left: none;
        border-bottom-color: white;
    }
}

@media (max-width: 575.98px) {
    .page-header {
        padding: 1rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .sidebar-header h2 {
        font-size: 1.1rem;
    }

    .pairing-code {
        font-size: 2rem;
        letter-spacing: 0.25rem;
    }
}

/* ===== Apply to Devices Section ===== */
.device-checkbox {
    cursor: pointer;
    transition: all 0.2s ease;
}

.device-checkbox:hover {
    background: #f9fafb;
}

[data-bs-theme="dark"] .device-checkbox:hover {
    background: #1f2937;
}

.device-checkbox.current-device {
    background: #eef2ff;
    border: 2px solid var(--bs-primary);
}

[data-bs-theme="dark"] .device-checkbox.current-device {
    background: #1e293b;
}

/* ===== Loading States ===== */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* ===== Utility Classes ===== */
.text-gradient {
    background: linear-gradient(135deg, var(--bs-primary) 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-sm-hover {
    transition: box-shadow 0.2s ease;
}

.shadow-sm-hover:hover {
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.15) !important;
}
