/* GPS Tracker - Responsive Dashboard CSS */

:root {
    --primary: #1B4F72;
    --primary-light: #2874A6;
    --secondary: #2D3748;
    --accent: #E67E22;
    --success: #27AE60;
    --warning: #F39C12;
    --danger: #E74C3C;
    --bg: #F5F7FA;
    --card: #FFFFFF;
    --border: #E2E8F0;
    --text: #2D3748;
    --text-muted: #718096;

    --sidebar-width: 260px;
    --header-height: 60px;
    --radius: 12px;
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* Pages */
.page { display: none; }
.page.active { display: block; }

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    padding: 20px;
}

.login-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo-icon {
    font-size: 48px;
    color: var(--accent);
    margin-bottom: 10px;
}

.login-header h1 {
    font-size: 28px;
    color: var(--primary);
    margin-bottom: 5px;
}

.login-header p {
    color: var(--text-muted);
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 500;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
}

.login-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: #D35400;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(230, 126, 34, 0.4);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--card);
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-shadow: var(--shadow);
    z-index: 100;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text);
    cursor: pointer;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.header-title i {
    color: var(--accent);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.notification-badge {
    position: relative;
    cursor: pointer;
}

.notification-badge .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    cursor: pointer;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--primary);
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header i {
    color: var(--accent);
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    background: var(--accent);
    color: white;
}

.nav-item i {
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 10px 0;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 24px;
    min-height: calc(100vh - var(--header-height));
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.content-section h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    color: var(--primary);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-card.warning .stat-icon {
    background: linear-gradient(135deg, var(--warning), #E67E22);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

.stat-label {
    color: var(--text-muted);
    font-size: 14px;
}

/* Cards */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
}

.card-body {
    padding: 20px;
}

/* Children Grid */
.children-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.child-card {
    background: var(--bg);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.child-card:hover {
    background: var(--primary);
    color: white;
}

.child-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
}

.child-info h4 {
    margin-bottom: 4px;
}

.child-status {
    font-size: 12px;
    opacity: 0.8;
}

.child-status.online {
    color: var(--success);
}

/* Maps */
.mini-map {
    height: 300px;
    border-radius: 10px;
    overflow: hidden;
}

.main-map {
    height: calc(100vh - 220px); min-height: 500px;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
}

.map-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.location-info {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.info-item {
    background: var(--bg);
    padding: 12px;
    border-radius: 8px;
}

.info-item label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.info-item span {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.form-select {
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    min-width: 180px;
}

/* Screenshots Grid */
.screenshots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.screenshot-item {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.screenshot-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.screenshot-info {
    padding: 12px;
}

.screenshot-info .app {
    font-weight: 600;
    color: var(--primary);
}

.screenshot-info .time {
    font-size: 12px;
    color: var(--text-muted);
}

/* Messages List */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message-item {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.message-source {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
}

.message-source.whatsapp { color: #25D366; }
.message-source.instagram { color: #E4405F; }
.message-source.sms { color: var(--primary); }

.message-time {
    font-size: 12px;
    color: var(--text-muted);
}

.message-contact {
    font-weight: 600;
    margin-bottom: 4px;
}

.message-text {
    color: var(--text);
}

/* Alerts List */
.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert-item {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

.alert-item:hover {
    transform: translateX(4px);
}

.alert-item.critical { border-left-color: var(--danger); }
.alert-item.warning { border-left-color: var(--warning); }
.alert-item.info { border-left-color: var(--primary); }

.alert-item.unread {
    background: #FEF9E7;
}

.alert-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.alert-title {
    font-weight: 600;
}

.alert-time {
    font-size: 12px;
    color: var(--text-muted);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card);
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.modal-body .form-group {
    margin-bottom: 16px;
}

.modal-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.modal-body input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid var(--border);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    transform: translateX(400px);
    transition: transform 0.3s;
    z-index: 2000;
}

.toast.show {
    transform: translateX(0);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge.success { background: var(--success); color: white; }
.badge.warning { background: var(--warning); color: white; }
.badge.danger { background: var(--danger); color: white; }

/* Utilities */
.mb-3 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .header-title {
        display: none;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 16px;
    }

    .main-content {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .map-controls {
        flex-direction: column;
    }

    .map-controls .btn,
    .map-controls .form-select {
        width: 100%;
    }

    .main-map {
        height: 350px;
    }

    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 24px;
    }

    .login-card {
        padding: 24px;
    }

    .children-grid {
        grid-template-columns: 1fr;
    }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
}

.sidebar-overlay.show {
    display: block;
}
