/* Parental Monitor Dashboard - Styles */

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

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #0f172a;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
}

html {
    scroll-behavior: smooth;
}

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

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #333;
    font-size: 32px;
    margin-bottom: 8px;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    color: #333;
    font-weight: 500;
    margin-bottom: 8px;
}

.login-form input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.form-footer {
    text-align: center;
    margin-top: 20px;
    color: #666;
    font-size: 14px;
}

.form-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 24px;
    margin-bottom: 4px;
}

.sidebar-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

.sidebar-nav {
    flex: 1;
    padding: 16px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 4px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s;
}

.nav-item span {
    margin-right: 12px;
    font-size: 20px;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    background: var(--bg-card);
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar h1 {
    font-size: 28px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

#lastUpdate {
    font-size: 14px;
    color: var(--text-secondary);
}

.content-area {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.stat-card h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

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

/* Cards */
.card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.card h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

/* Devices Grid */
.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.device-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.3s;
}

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

.device-card h4 {
    font-size: 18px;
    margin-bottom: 12px;
}

.device-info {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.device-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.device-status.online {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.device-status.offline {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

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

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

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 8px 12px;
    background: transparent;
    color: var(--text-primary);
    font-size: 18px;
}

/* Command Buttons Grid */
.command-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.command-buttons h4 {
    grid-column: 1 / -1;
    margin-bottom: 8px;
}

.command-buttons .btn {
    padding: 12px;
    font-size: 13px;
}

/* Form Controls */
.form-control, select {
    width: 100%;
    padding: 10px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.form-control:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Pages */
.page {
    display: none;
}

.page.active {
    display: block;
}

.page-actions {
    margin-bottom: 20px;
}

/* Locations List */
.locations-list {
    margin-top: 20px;
}

.location-item {
    background: var(--bg-card);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 12px;
}

/* Alerts */
.alert-item {
    background: var(--bg-card);
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid var(--warning);
    margin-bottom: 12px;
}

.alert-item.read {
    opacity: 0.6;
}

.alert-item.high {
    border-left-color: var(--danger);
}

/* Error Message */
.error-message {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    padding: 12px;
    border-radius: 8px;
    margin-top: 16px;
}

/* Success Message */
.success-message {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    padding: 12px;
    border-radius: 8px;
    margin-top: 16px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Device Item */
.device-item {
    background: var(--bg-card);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.device-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

/* Text Utilities */
.text-secondary {
    color: var(--text-secondary);
}

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--success);
}

/* Notification Toast */
.notification-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 16px 24px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    font-size: 15px;
    font-weight: 500;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    max-width: 400px;
}

.notification-toast.show {
    transform: translateX(0);
}

.notification-toast.success {
    border-left: 4px solid var(--success);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(16, 185, 129, 0.1) 100%);
}

.notification-toast.error {
    border-left: 4px solid var(--danger);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(239, 68, 68, 0.1) 100%);
}

.notification-toast.info {
    border-left: 4px solid var(--primary);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(79, 70, 229, 0.1) 100%);
}

/* Command Cards */
.command-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, #1a2332 100%);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0;
    margin-bottom: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.command-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(79, 70, 229, 0.2);
    border-color: var(--primary);
}

.command-card.pending {
    border-left: 4px solid var(--warning);
}

.command-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(79, 70, 229, 0.1);
    border-bottom: 1px solid var(--border);
}

.command-header h4 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
    text-transform: capitalize;
}

.status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.completed {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.status-badge.failed {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.command-body {
    padding: 24px;
}

/* Response Table Styles */
.response-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-main);
    border-radius: 8px;
    overflow: hidden;
}

.response-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.2s ease;
}

.response-table tbody tr:last-child {
    border-bottom: none;
}

.response-table tbody tr:hover {
    background: rgba(79, 70, 229, 0.05);
}

.response-table td {
    padding: 8px 12px;
}

.table-label {
    font-weight: 600;
    color: var(--text-secondary);
    width: 40%;
    text-transform: capitalize;
    font-size: 14px;
}

.table-value {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 15px;
}

.btn-map {
    display: inline-block;
    margin-left: 12px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.btn-map:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.info-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.info-card {
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.info-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #7c3aed);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.info-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

.info-card:hover::before {
    opacity: 1;
}

.info-card.full-width {
    grid-column: 1 / -1;
    text-align: left;
}

.info-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.info-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.info-extra {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.info-text {
    padding: 16px;
    background: var(--bg-main);
    border-radius: 8px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.waiting-text {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 16px;
    font-style: italic;
}

.command-footer {
    padding: 16px 24px;
    background: rgba(15, 23, 42, 0.5);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.command-footer small {
    color: var(--text-secondary);
    font-size: 13px;
}

.command-history {
    margin-top: 32px;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border);
}

.command-history h3 {
    margin-bottom: 24px;
    font-size: 22px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.command-history h3::before {
    content: '📜';
    font-size: 24px;
}

/* Commands Section Styling */
.commands-section {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border);
    margin-bottom: 32px;
}

.commands-section h3 {
    margin-bottom: 20px;
    font-size: 20px;
}

.commands-section select {
    margin-bottom: 20px;
}

.custom-command {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.custom-command h4 {
    margin-bottom: 12px;
    font-size: 16px;
    color: var(--text-secondary);
}

.custom-command input {
    margin-bottom: 12px;
}

/* View Media Button */
.btn-view-media {
    margin-left: auto;
    padding: 8px 16px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.btn-view-media:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.3);
}

/* Media Modal */
.media-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.media-modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

.media-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.media-modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.media-modal-body {
    padding: 24px;
}

.media-info {
    color: var(--text-primary);
    line-height: 1.8;
}

.media-info ul {
    margin: 10px 0;
    padding-left: 20px;
}

.media-info li {
    margin: 8px 0;
    color: var(--text-secondary);
}

.media-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Responsive */
@media (max-width: 768px) {
    .dashboard {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
    }
    
    .sidebar-nav {
        display: flex;
        overflow-x: auto;
    }
    
    .nav-item {
        flex-shrink: 0;
    }
    
    .info-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 12px;
    }
    
    .info-card {
        padding: 16px;
    }
    
    .info-icon {
        font-size: 28px;
    }
    
    .info-value {
        font-size: 20px;
    }
}

