* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0066cc;
    --primary-hover: #0052a3;
    --accent-color: #00b4d8;
    --success-color: #06a77d;
    --danger-color: #d62828;
    --warning-color: #f77f00;
    
    --background: #f5f7fa;
    --surface: #ffffff;
    --surface-alt: #f8f9fb;
    
    --text-primary: #1a1a1a;
    --text-secondary: #606060;
    --text-light: #8a8a8a;
    
    --border-color: #e0e4e8;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
    
    --transition: all 0.2s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============= LOGIN PAGE ============= */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8eef5 100%);
}

.login-box {
    background: var(--surface);
    padding: 48px 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

.login-box h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 28px;
    font-weight: 700;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 14px;
}

/* ============= FORMS ============= */
.form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 11px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background-color: var(--surface-alt);
    transition: var(--transition);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    background-color: var(--surface);
    border-color: #d0d4d8;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--surface);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.form-group input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

/* ============= BUTTONS ============= */
.btn {
    padding: 11px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

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

.btn-secondary {
    background-color: var(--surface-alt);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-small {
    padding: 8px 14px;
    font-size: 13px;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #b81c1c;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #058270;
}

/* ============= MESSAGES ============= */
.error-message,
.success-message,
.warning-message {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 14px;
    display: none;
}

.error-message {
    display: block;
    background-color: #ffe5e5;
    color: #8b0000;
    border: 1px solid #ffcccc;
}

.success-message {
    display: block;
    background-color: #e5f5f0;
    color: #036b5c;
    border: 1px solid #b3e5db;
}

.warning-message {
    background-color: #fff3e5;
    color: #7d4200;
    border: 1px solid #ffe0b3;
}

/* ============= NAVBAR ============= */
.navbar {
    background-color: var(--surface);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-right span {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ============= SIDEBAR ============= */
.sidebar {
    width: 250px;
    background-color: var(--surface);
    border-right: 1px solid var(--border-color);
    min-height: calc(100vh - 60px);
    position: fixed;
    left: 0;
    top: 60px;
    overflow-y: auto;
    padding: 20px 0;
}

.menu {
    list-style: none;
}

.menu li a {
    display: block;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    font-size: 14px;
    border-left: 3px solid transparent;
    font-weight: 500;
}

.menu li a:hover,
.menu li a.active {
    background-color: var(--background);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

/* ============= MAIN CONTENT ============= */
.main-content {
    margin-left: 250px;
    padding: 30px 20px;
    min-height: calc(100vh - 60px);
}

.main-content h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
}

/* ============= SECTIONS ============= */
.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============= CARDS ============= */
.card {
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    transition: var(--transition);
    cursor: pointer;
}

.card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card .stat {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
}

/* ============= DASHBOARD CARDS ============= */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* ============= LISTS ============= */
.children-list,
.restrictions-list,
.schedules-list,
.app-breakdown,
.rewards-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.list-item {
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.list-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.list-item-content {
    flex: 1;
}

.list-item-content h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.list-item-content p {
    font-size: 13px;
    color: var(--text-secondary);
}

.list-item-actions {
    display: flex;
    gap: 8px;
}

/* ============= CONTROLS ============= */
.analytics-controls,
.schedule-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.analytics-controls select,
.schedule-controls select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    background-color: var(--surface-alt);
    cursor: pointer;
    transition: var(--transition);
}

.analytics-controls select:hover,
.schedule-controls select:hover {
    border-color: var(--primary-color);
}

.analytics-controls select:focus,
.schedule-controls select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* ============= ANALYTICS ============= */
.analytics-summary {
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.analytics-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.analytics-summary-item:last-child {
    border-bottom: none;
}

.analytics-summary-item span:first-child {
    color: var(--text-secondary);
    font-size: 14px;
}

.analytics-summary-item span:last-child {
    font-weight: 600;
    color: var(--text-primary);
}

.app-breakdown .list-item {
    flex-direction: column;
    align-items: flex-start;
}

.app-info {
    width: 100%;
}

.app-name {
    font-weight: 600;
    margin-bottom: 8px;
}

.app-stats {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============= MODAL/DIALOG ============= */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--surface);
    padding: 32px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    position: relative;
}

.modal-header {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.close {
    position: absolute;
    right: 16px;
    top: 16px;
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-light);
    background: none;
    border: none;
    padding: 0;
}

.close:hover {
    color: var(--text-primary);
}

/* ============= RESPONSIVE ============= */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 20px 16px;
    }

    .dashboard-cards {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        padding: 24px;
    }

    .list-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .list-item-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 12px;
    }

    .nav-right {
        gap: 12px;
    }

    .btn-small {
        width: 100%;
    }

    .analytics-summary-item {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============= SCROLLBAR ============= */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #bbc4cc;
}

/* ============= UTILITY CLASSES ============= */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-light);
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
