* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #111827;
    color: #f3f4f6;
}

.topbar {
    background: #0f172a;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid #1f2937;
    flex-wrap: wrap;
}

.brand-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand {
    font-size: 22px;
    font-weight: bold;
    color: #60a5fa;
    line-height: 1.1;
}

.subbrand {
    font-size: 13px;
    color: #cbd5e1;
}

.topnav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.topnav a {
    color: #e5e7eb;
    text-decoration: none;
    padding: 10px 14px;
    background: #1e293b;
    border-radius: 10px;
    font-size: 14px;
}

.container {
    padding: 18px;
    max-width: 1500px;
    margin: 0 auto;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    gap: 12px;
    flex-wrap: wrap;
}

.page-head h1 {
    margin: 0;
    font-size: 28px;
}

.page-subtitle {
    margin: 6px 0 0 0;
    color: #cbd5e1;
    font-size: 14px;
}

.flash {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
}

.flash.success { background: #14532d; }
.flash.danger { background: #7f1d1d; }
.flash.info { background: #1e3a8a; }

.login-card,
.panel {
    background: #1f2937;
    padding: 20px;
    border-radius: 14px;
    margin-bottom: 24px;
    box-shadow: 0 0 12px rgba(0,0,0,0.25);
}

.login-card {
    max-width: 420px;
    margin: 40px auto;
}

label {
    display: block;
    margin-top: 12px;
    margin-bottom: 6px;
    font-weight: bold;
}

input,
select,
button {
    width: 100%;
    padding: 11px 12px;
    border-radius: 10px;
    border: none;
    box-sizing: border-box;
    margin-bottom: 10px;
    font-size: 15px;
}

button,
.btn {
    background: #2563eb;
    color: white;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    display: inline-block;
    padding: 11px 16px;
    border-radius: 10px;
    border: none;
    font-size: 14px;
}

.btn-primary {
    background: #2563eb;
}

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

.camera-card {
    background: #1f2937;
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 0 12px rgba(0,0,0,0.25);
}

.camera-status {
    margin-top: 6px;
    font-size: 14px;
}

.status-up {
    color: #22c55e;
    font-weight: bold;
}

.status-down {
    color: #ef4444;
    font-weight: bold;
}

.camera-card-top {
    margin-bottom: 12px;
}

.camera-card-alert {
    border: 2px solid #ef4444;
}

.alert-box {
    margin-top: 12px;
    padding: 10px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
}

.alert-box-title {
    font-weight: bold;
    margin-bottom: 6px;
}

.alert-message {
    font-size: 14px;
    margin-bottom: 6px;
}

.alert-time {
    font-size: 12px;
    color: #9ca3af;
}
.camera-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 8px;
}

.camera-meta {
    font-size: 14px;
    color: #d1d5db;
    line-height: 1.5;
}

.camera-preview-link {
    display: block;
    text-decoration: none;
}

.camera-feed {
    width: 100%;
    border-radius: 14px;
    background: black;
    display: block;
    min-height: 220px;
    object-fit: cover;
}

.card-actions {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.fullscreen-wrap {
    width: 100%;
}

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

.fullscreen-header h1 {
    margin: 0 0 8px 0;
}

.fullscreen-actions {
    display: flex;
    gap: 10px;
}

.fullscreen-video-box {
    margin-top: 8px;
    background: black;
    padding: 10px;
    border-radius: 16px;
}

.fullscreen-video {
    width: 100%;
    max-height: 84vh;
    object-fit: contain;
    display: block;
    border-radius: 10px;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table th,
table td {
    border-bottom: 1px solid #374151;
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

.note,
.empty-state {
    color: #cbd5e1;
    margin-top: 10px;
}

.empty-state {
    background: #1f2937;
    padding: 18px;
    border-radius: 14px;
}

.summary-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.summary-card {
    background: #1e293b;
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
}

.summary-label {
    font-size: 13px;
    color: #9ca3af;
    margin-bottom: 6px;
}

.summary-value {
    font-size: 28px;
    font-weight: bold;
    color: #e5e7eb;
}

.summary-online {
    border-left: 4px solid #22c55e;
}

.summary-offline {
    border-left: 4px solid #ef4444;
}

.topbar {
    background: #111827;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #1f2937;
    flex-wrap: wrap;
    gap: 10px;
}

.topbar-left h2 {
    margin: 0;
    font-size: 18px;
    color: #e5e7eb;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.user-label {
    color: #cbd5e1;
    font-size: 14px;
    margin-right: 6px;
}

.nav-btn {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    color: white;
    background: #2563eb;
}

.nav-admin {
    background: #7c3aed;
}

.nav-logout {
    background: #dc2626;
}

.flash-message {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #1e293b;
}

.recent-alerts-panel {
    background: #1e293b;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 20px;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
}

.recent-alerts-header {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 12px;
    color: #e5e7eb;
}

.recent-alerts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recent-alert-item {
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.recent-alert-down {
    border-left: 4px solid #ef4444;
}

.recent-alert-up {
    border-left: 4px solid #22c55e;
}

.recent-alert-main {
    font-size: 14px;
    color: #e5e7eb;
}

.recent-alert-time {
    font-size: 12px;
    color: #9ca3af;
}

.recent-alert-empty {
    color: #9ca3af;
    font-size: 14px;
}

.ack-badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    background: #14532d;
    color: #dcfce7;
    font-size: 12px;
    font-weight: bold;
}

.btn-ack {
    background: #d97706;
}

.recent-alert-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.btn-ack-small {
    background: #d97706;
    font-size: 12px;
    padding: 4px 8px;
}

@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .topbar {
        padding: 12px;
    }

    .brand {
        font-size: 20px;
    }

    .topnav {
        width: 100%;
    }

    .topnav a {
        flex: 1 1 auto;
        text-align: center;
    }

    .page-head h1 {
        font-size: 22px;
    }

    .camera-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .camera-card {
        padding: 12px;
    }

    .camera-feed {
        min-height: 240px;
    }

    .card-actions .btn {
        width: 100%;
    }

    .fullscreen-video {
        max-height: 70vh;
    }

    table {
        font-size: 13px;
    }
}
/* ===== MOBILE POLISH LAYER ===== */

@media (max-width: 768px) {

    /* NAV — make it feel like buttons */
    .topnav {
        gap: 6px;
    }

    .topnav a {
        padding: 12px;
        font-size: 14px;
        border-radius: 8px;
        background: #1e293b;
    }

    /* BUTTONS — easier tapping */
    .btn {
        padding: 14px;
        font-size: 16px;
        border-radius: 10px;
    }

    /* CAMERA CARDS — more breathing room */
    .camera-card {
        padding: 14px;
        border-radius: 12px;
    }

    /* ALERT PANEL — THIS IS THE BIG ONE */
    .recent-alert-item {
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding: 10px;
        border-radius: 8px;
    }

    .recent-alert-right {
        display: flex;
        justify-content: space-between;
        width: 100%;
    }

    /* ACK BUTTON easier */
    .btn-ack-small {
        padding: 8px 12px;
        font-size: 13px;
    }

    /* SUMMARY BAR nicer stacking */
    .summary-bar {
        grid-template-columns: 1fr;
    }

    /* FULLSCREEN — more immersive */
    .fullscreen-video {
        width: 100%;
        max-height: 80vh;
        border-radius: 10px;
    }
}
