/* dashboard.css - Component Styling for Alex Command Center */

/* 1. Top Navbar (Tapo 3.0 Clean White Style) */
.top-navbar {
    height: var(--header-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(14, 165, 233, 0.25);
}

.brand-title {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.1;
}

.brand-badge {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--accent-primary);
    text-transform: uppercase;
}

/* Search Bar */
.nav-center {
    flex: 1;
    max-width: 480px;
    margin: 0 24px;
}

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 14px;
    color: var(--text-subtle);
}

.search-bar input {
    width: 100%;
    padding: 10px 14px 10px 42px;
    background: var(--bg-main);
    border: 1px solid transparent;
    font-size: 0.9rem;
    border-radius: var(--radius-lg);
}

.search-bar input:focus {
    background: var(--bg-surface);
    border-color: var(--accent-primary);
}

/* Nav Right & User Status */
.nav-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--status-online-bg);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #065F46;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--status-online);
    border-radius: 50%;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: var(--bg-main);
    position: relative;
    border: 1px solid var(--border-color);
}

.icon-btn:hover {
    color: var(--accent-primary);
    background: var(--accent-primary-light);
    border-color: var(--accent-primary);
}

.btn-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent-primary);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #1E293B;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
}

/* 2. Quick Routines Section (1-Click Daily Routines Bar) */
.quick-routines-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px 24px;
    margin-bottom: 28px;
    box-shadow: var(--shadow-sm);
}

.section-header-compact {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 14px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 10px;
}

.section-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.routines-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.routine-pill {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-main);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.routine-pill:hover {
    transform: translateY(-2px);
    background: var(--accent-secondary-light);
    border-color: var(--accent-secondary);
    color: var(--accent-secondary);
    box-shadow: var(--shadow-md);
}

.routine-icon {
    font-size: 1.3rem;
}

/* 3. Dashboard Controls Header */
.dashboard-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.controls-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-heading {
    font-size: 1.5rem;
    color: var(--text-main);
}

.device-summary {
    display: flex;
    gap: 8px;
}

.count-pill {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.count-pill.online {
    background: var(--status-online-bg);
    color: #065F46;
}

.count-pill.offline {
    background: var(--status-offline-bg);
    color: #991B1B;
}

.controls-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.view-switcher {
    display: flex;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 3px;
}

.view-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.view-btn.active {
    background: var(--text-main);
    color: white;
}

.action-btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--accent-primary);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 10px rgba(14, 165, 233, 0.3);
}

.action-btn-primary:hover {
    background: var(--accent-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(14, 165, 233, 0.4);
}

/* 4. Camera Grid Layout (Tapo Grid Multi-View) */
.camera-grid-container.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 24px;
}

/* List Layout Override */
.camera-grid-container.list-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Camera Card Component */
.camera-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.camera-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: #CBD5E1;
}

.camera-card.offline {
    opacity: 0.75;
}

/* Video Preview Area */
.card-preview-viewport {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background: #0F172A;
    overflow: hidden;
    cursor: pointer;
}

.preview-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
}

.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0) 40%, rgba(0,0,0,0.6) 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 14px 16px;
    color: white;
}

.preview-top-tags {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.live-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.live-dot {
    width: 6px;
    height: 6px;
    background: var(--status-live);
    border-radius: 50%;
}

.model-tag {
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    padding: 3px 8px;
    border-radius: 6px;
}

.preview-center-action {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease;
    background: rgba(14, 165, 233, 0.9);
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.card-preview-viewport:hover .preview-center-action {
    opacity: 1;
    transform: scale(1);
}

/* Card Footer Info & 1-Click Action Toolbar */
.card-footer {
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
}

.card-info h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 2px;
}

.card-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-actions-toolbar {
    display: flex;
    gap: 8px;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    color: var(--text-main);
}

.toolbar-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.toolbar-btn.btn-talk {
    background: var(--accent-primary-light);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.toolbar-btn.btn-talk:hover {
    background: var(--accent-primary);
    color: white;
}

/* 5. List Layout Styling Overrides */
.camera-grid-container.list-layout .camera-card {
    flex-direction: row;
    height: 110px;
    align-items: center;
}

.camera-grid-container.list-layout .card-preview-viewport {
    width: 195px;
    height: 100%;
    padding-top: 0;
}

.camera-grid-container.list-layout .card-footer {
    flex: 1;
    padding: 0 24px;
}

/* 6. Modals (Announcement & Fullscreen) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header h3 {
    font-size: 1.2rem;
}

.close-btn {
    font-size: 1.5rem;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: var(--bg-main);
    color: var(--text-main);
}

.modal-body {
    padding: 24px;
}

.modal-help {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.preset-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.preset-btn {
    padding: 6px 12px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-main);
}

.preset-btn:hover {
    background: var(--accent-primary-light);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.modal-body textarea {
    width: 100%;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-secondary {
    padding: 10px 18px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-weight: 600;
    color: var(--text-main);
}

.btn-secondary:hover {
    background: var(--bg-main);
}

.btn-primary {
    padding: 10px 22px;
    background: var(--accent-primary);
    color: white;
    font-weight: 600;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 10px rgba(14, 165, 233, 0.25);
}

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

/* 7. Fullscreen Video Modal Viewport */
.fullscreen-container {
    background: #0F172A;
    width: 95vw;
    height: 90vh;
    max-width: 1400px;
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.fullscreen-header {
    padding: 18px 24px;
    background: rgba(15, 23, 42, 0.9);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

.fs-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fs-status-dot {
    width: 10px;
    height: 10px;
    background: var(--status-online);
    border-radius: 50%;
}

.fs-title-group h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.fs-model-badge {
    background: rgba(255, 255, 255, 0.15);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
}

.fs-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.fs-mode-tag {
    background: rgba(14, 165, 233, 0.2);
    color: #38BDF8;
    border: 1px solid rgba(14, 165, 233, 0.4);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.fs-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fs-close-btn:hover {
    background: rgba(239, 68, 68, 0.8);
}

.fullscreen-video-viewport {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

/* Fullscreen Nav Arrows */
.fs-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.fs-nav-arrow:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.6);
    transform: translateY(-50%) scale(1.1);
    color: white;
}

.fs-nav-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.fs-nav-arrow.prev {
    left: 24px;
}

.fs-nav-arrow.next {
    right: 24px;
}

.stream-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    z-index: 2;
}

.stream-status {
    margin-top: 20px;
}

.live-badge {
    background: #EF4444;
    color: white;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 6px 14px;
    border-radius: 20px;
    letter-spacing: 0.08em;
}

.stream-info {
    color: #94A3B8;
    font-size: 0.9rem;
    margin-top: 10px;
    max-width: 400px;
}

.simulated-feed-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0.65;
    z-index: 1;
}

.fullscreen-bottom-bar {
    padding: 20px 28px;
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.action-dock {
    display: flex;
    gap: 12px;
}

.dock-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.9rem;
}

.dock-btn:hover, .dock-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.5);
}

.fs-quick-commands {
    display: flex;
    gap: 8px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
}

.toast {
    background: var(--text-main);
    color: white;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success { border-left: 4px solid var(--status-online); }
.toast.info { border-left: 4px solid var(--accent-primary); }
