/* Modern Alarm Control - Dark Theme with Glassmorphism */

/* Google Font */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    /* Dark theme */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: rgba(0, 0, 0, 0.3);
    
    /* Text */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-muted: rgba(255, 255, 255, 0.4);
    
    /* Status kleuren */
    --alarm-on: #ef4444;
    --alarm-on-glow: rgba(239, 68, 68, 0.4);
    --alarm-off: #22c55e;
    --alarm-off-glow: rgba(34, 197, 94, 0.4);
    --alarm-partial: #f59e0b;
    --alarm-partial-glow: rgba(245, 158, 11, 0.4);
    
    /* Accent */
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.3);
}

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

html {
    height: -webkit-fill-available;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Animated gradient background */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(239, 68, 68, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(34, 197, 94, 0.05) 0%, transparent 70%);
    animation: gradientShift 15s ease-in-out infinite alternate;
    z-index: -1;
    pointer-events: none;
}

@keyframes gradientShift {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0.8; transform: scale(1.1); }
}

/* Container */
.app-container {
    max-width: 420px;
    margin: 0 auto;
    padding: 24px 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* iPhone safe areas */
@supports (padding: max(0px)) {
    .app-container {
        padding-top: max(24px, env(safe-area-inset-top));
        padding-bottom: max(24px, env(safe-area-inset-bottom));
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logout-btn {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

/* Status Badge */
.status-badge {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    text-align: center;
    transition: all 0.3s ease;
}

.status-badge.alarm-on {
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 40px var(--alarm-on-glow), inset 0 0 30px rgba(239, 68, 68, 0.05);
}

.status-badge.alarm-off {
    border-color: rgba(34, 197, 94, 0.3);
    box-shadow: 0 0 40px var(--alarm-off-glow), inset 0 0 30px rgba(34, 197, 94, 0.05);
}

.status-badge.alarm-partial {
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow: 0 0 40px var(--alarm-partial-glow), inset 0 0 30px rgba(245, 158, 11, 0.05);
}

.status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.status-dot.on { 
    background: var(--alarm-on); 
    box-shadow: 0 0 20px var(--alarm-on); 
}

.status-dot.off { 
    background: var(--alarm-off); 
    box-shadow: 0 0 20px var(--alarm-off); 
    animation: none; 
}

.status-dot.partial { 
    background: var(--alarm-partial); 
    box-shadow: 0 0 20px var(--alarm-partial); 
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}

.status-text {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.status-text.on { color: var(--alarm-on); }
.status-text.off { color: var(--alarm-off); }
.status-text.partial { color: var(--alarm-partial); }

.status-subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

/* Camera Cards */
.cameras-section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.camera-list {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
}

.camera-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-border);
    transition: background 0.2s ease;
}

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

.camera-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.camera-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.camera-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-secondary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-name {
    font-size: 15px;
    font-weight: 500;
}

.camera-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.camera-status.on { 
    color: var(--alarm-on);
    background: rgba(239, 68, 68, 0.05);
}

.camera-status.off { 
    color: var(--alarm-off);
    background: rgba(34, 197, 94, 0.05);
}

.camera-status:hover {
    transform: scale(1.05);
}

.camera-status:active {
    transform: scale(0.95);
}

.camera-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.camera-status-dot.on { background: var(--alarm-on); }
.camera-status-dot.off { background: var(--alarm-off); }

/* Action Buttons */
.actions-section {
    margin-bottom: 24px;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.action-form {
    display: contents;
}

.action-btn {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.action-btn:hover {
    transform: translateY(-2px);
}

.action-btn:active {
    transform: scale(0.92);
    transition: transform 0.1s ease;
}

.action-btn.arm {
    border-color: rgba(239, 68, 68, 0.2);
}

.action-btn.arm:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.2);
}

.action-btn.disarm {
    border-color: rgba(34, 197, 94, 0.2);
}

.action-btn.disarm:hover {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.4);
    box-shadow: 0 8px 32px rgba(34, 197, 94, 0.2);
}

.action-btn.home {
    border-color: rgba(245, 158, 11, 0.2);
}

.action-btn.home:hover {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 8px 32px rgba(245, 158, 11, 0.2);
}

.action-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn.arm .action-icon { background: linear-gradient(135deg, #ef4444, #dc2626); }
.action-btn.disarm .action-icon { background: linear-gradient(135deg, #22c55e, #16a34a); }
.action-btn.home .action-icon { background: linear-gradient(135deg, #f59e0b, #d97706); }

.action-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Timer Section */
.timer-section {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
}

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

.timer-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
}

.timer-toggle {
    position: relative;
    width: 48px;
    height: 28px;
    background: var(--bg-secondary);
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.timer-toggle.active {
    background: var(--accent);
}

.timer-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.timer-toggle.active::after {
    transform: translateX(20px);
}

.timer-times {
    display: flex;
    gap: 16px;
}

.timer-time {
    flex: 1;
    text-align: center;
}

.timer-time-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.timer-time-value {
    font-size: 24px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Settings/Primary Button */
.btn-primary {
    width: 100%;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-primary:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.12);
}

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

.btn-primary.accent:hover {
    background: #5558e3;
}

.btn-secondary {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
}

/* Loading overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

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

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

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

/* Toast notification */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 200;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success { border-color: rgba(34, 197, 94, 0.4); }
.toast.error { border-color: rgba(239, 68, 68, 0.4); }

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 16px;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* Card component */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
}

/* SVG Icons */
svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.action-icon svg {
    stroke: white;
}

/* Login specific */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 380px;
}

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

.login-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.login-icon svg {
    width: 32px;
    height: 32px;
    stroke: white;
}

.login-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

/* Timer settings specific */
.settings-container {
    max-width: 420px;
    margin: 0 auto;
    padding: 24px 16px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 24px;
    transition: color 0.2s ease;
}

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

.page-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 32px;
}

/* Utility classes */
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.text-center { text-align: center; }
