/* ===========================
   FIREBASE CONTROL DASHBOARD
   =========================== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #333;
}

.container {
    width: 100%;
    max-width: 600px;
}

/* ===========================
   HEADER
   =========================== */

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

header .subtitle {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* ===========================
   CONTROLS GRID
   =========================== */

.controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 500px) {
    .controls-grid {
        grid-template-columns: 1fr;
    }
}

/* ===========================
   CONTROL CARD
   =========================== */

.control-card {
    background: white;
    border-radius: 16px;
    padding: 30px 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.control-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
}

.control-card.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.control-card.inactive {
    background: #f5f5f5;
    color: #999;
}

/* ===========================
   CONTROL ICON
   =========================== */

.control-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.control-card.active .control-icon {
    color: #667eea;
    text-shadow: 0 0 20px rgba(102, 126, 234, 0.4);
    animation: pulse-icon 2s ease-in-out infinite;
}

.control-card.inactive .control-icon {
    color: #ccc;
    opacity: 0.5;
}

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

/* ===========================
   CONTROL LABEL
   =========================== */

.control-label {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.control-card.active .control-label {
    color: white;
}

.control-card.inactive .control-label {
    color: #999;
}

/* ===========================
   CONTROL STATUS
   =========================== */

.control-status {
    margin-bottom: 15px;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.control-card.active .status-text {
    color: #667eea;
}

.control-card.inactive .status-text {
    color: #ccc;
}

/* ===========================
   CONTROL BUTTON
   =========================== */

.control-button {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.control-button:hover {
    background: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.control-button:active {
    transform: translateY(0);
}

.control-card.inactive .control-button {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

.control-card.inactive .control-button:hover {
    background: #ccc;
    transform: none;
}

/* ===========================
   FOOTER / CONNECTION STATUS
   =========================== */

footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.connection-status {
    color: white;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff6b6b;
    animation: blink 1.5s ease-in-out infinite;
}

.connection-status.connected .status-dot {
    background: #51cf66;
    animation: none;
}

.connection-status.connected .status-label {
    opacity: 0.8;
}

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

/* ===========================
   LOADING STATE
   =========================== */

.control-card.loading .control-icon {
    animation: spin 2s linear infinite;
}

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

/* ===========================
   ACCESSIBILITY
   =========================== */

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    }

    .control-card {
        background: #2d2d44;
        color: #e0e0e0;
    }

    .control-card.inactive {
        background: #1a1a2e;
    }

    .control-label,
    .status-text {
        color: #e0e0e0;
    }

    .control-card.inactive .control-label,
    .control-card.inactive .status-text,
    .control-card.inactive .control-icon {
        color: #555;
    }
}
