/* 
 * style.css - SLD BabyCam Modern Responsive Dark UI 
 */

:root {
    --bg-main: #0b0f19;
    --bg-card: #151c2e;
    --bg-card-hover: #1e2842;
    --border: #263453;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header & Nav */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(21, 28, 46, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-main);
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 9999px;
    border: 1px solid transparent;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.3);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.4);
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.3);
}

.pulse {
    animation: pulseGlow 1.5s infinite;
}

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

/* IP Connection Card */
.connection-info-card {
    background: linear-gradient(145deg, #131b2e, #1a243d);
    border: 1px solid #2e4168;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.connection-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.connection-icon {
    font-size: 1.8rem;
}

.connection-header h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #e2e8f0;
}

.ip-display-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #090d16;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    margin-top: 6px;
}

.ip-url-text {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 600;
    color: #60a5fa;
    font-size: 0.95rem;
    word-break: break-all;
    user-select: all;
}

.link-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: underline;
    margin-top: 10px;
    padding: 0;
}

.link-btn:hover {
    color: #cbd5e1;
}

.all-ips-list {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.all-ip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.25);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
}

.baby-connect-url-box {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin: 12px auto;
    max-width: 440px;
    text-align: left;
}

/* Views Container */
.main-content {
    flex: 1;
    padding: 16px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* Cards & Modals */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

/* Landing View */
.hero-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 8px;
    text-align: center;
    background: linear-gradient(135deg, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 24px;
}

.role-selector {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 640px) {
    .role-selector {
        grid-template-columns: 1fr 1fr;
    }
}

.role-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.role-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.role-card h3 {
    font-size: 1.25rem;
    margin-bottom: 6px;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

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

.btn-secondary {
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: #334155;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
}

.btn-active {
    background: #10b981 !important;
    color: white !important;
}

/* Inputs */
.input-group {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.text-input {
    flex: 1;
    background: #0b0f19;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-main);
    font-size: 1rem;
    text-align: center;
    letter-spacing: 2px;
    font-weight: 700;
}
.text-input:focus {
    outline: none;
    border-color: var(--primary);
}

.select-input {
    background: #0b0f19;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text-main);
    font-size: 0.9rem;
    width: 100%;
}

/* Video Containers */
.video-wrapper {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 16 / 9;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    border: 2px solid var(--border);
}

.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

.motion-border-flash {
    animation: motionFlash 0.6s infinite alternate;
}

@keyframes motionFlash {
    from { border: 3px solid #ef4444; box-shadow: 0 0 25px rgba(239, 68, 68, 0.8); }
    to { border: 3px solid transparent; box-shadow: none; }
}

/* QR Code */
.qr-wrapper {
    background: white;
    padding: 16px;
    border-radius: var(--radius-md);
    display: inline-block;
    margin: 16px 0;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

/* Room Code Banner */
.code-banner {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 4px;
    color: #60a5fa;
    margin: 8px 0;
    user-select: all;
}

/* Blackout Screen (OLED Battery Saver) */
.blackout-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000000; /* Pure black for OLED power savings */
    z-index: 9999;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.blackout-hint {
    color: #222222;
    font-size: 0.8rem;
    letter-spacing: 1px;
    user-select: none;
    text-align: center;
}

/* Audio VU Meter */
.vu-meter-container {
    height: 8px;
    background: #1e293b;
    border-radius: 9999px;
    overflow: hidden;
    margin: 8px 0;
}

.vu-meter-bar {
    height: 100%;
    width: 0%;
    background: var(--success);
    transition: width 0.05s ease-out;
}

/* Motion Alert Banner */
.alert-banner {
    background: linear-gradient(90deg, #dc2626, #ef4444);
    color: white;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 600;
    animation: slideDown 0.3s ease;
}

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

/* Controls Grid */
.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin-top: 14px;
}

/* Modal Popup */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    padding: 24px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

/* Motion Log */
.event-log {
    list-style: none;
    max-height: 120px;
    overflow-y: auto;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.event-log li {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Sliders */
.slider-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
}

.slider-control input[type="range"] {
    flex: 1;
    accent-color: var(--primary);
}
