@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap');

:root {
    --primary-color: #1877f2;
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-main: #050505;
    --text-sub: #65676b;
    --entry-color: #36a420;
    --exit-color: #dc3545;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

header {
    background-color: var(--card-bg);
    width: 100%;
    max-width: 800px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-sizing: border-box; /* Ensure padding doesn't overflow width */
}

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

h1 { margin: 0; font-size: 1.2rem; }

#connection-status {
    font-size: 0.85rem;
    font-weight: bold;
    color: #e63946;
}
#connection-status.connected { color: #2a9d8f; }

/* CONTROLS */
.controls {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap; /* Allow wrapping on mobile */
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.control-group.grow { flex-grow: 1; min-width: 200px; }

label { font-size: 0.75rem; color: var(--text-sub); font-weight: 600; }

select, input {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    font-family: 'Vazirmatn', sans-serif;
}

button#ack-btn {
    padding: 8px 16px;
    background-color: var(--bg-color);
    border: 1px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Vazirmatn', sans-serif;
}
button#ack-btn:hover { background-color: #e4e6eb; }

/* MAIN LAYOUT */
main {
    width: 100%;
    max-width: 800px;
    padding: 20px;
    box-sizing: border-box;
}

.section-title {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-sub);
    border-bottom: 2px solid #e4e6eb;
    padding-bottom: 8px;
    margin-top: 30px;
    margin-bottom: 15px;
}

.feed-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* CARDS */
.event-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    transition: transform 0.2s;
}

/* FILTERING HIDDEN STATE */
.event-card.hidden {
    display: none !important;
}

/* LIVE ANIMATION */
.live-new {
    animation: slideDown 0.5s ease-out;
    border-right: 5px solid var(--entry-color); /* RTL: Right border */
    border-left: none;
}

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

.event-icon {
    font-size: 1.8rem;
    margin-left: 16px; /* RTL: Left margin */
    margin-right: 0;
    width: 40px;
    text-align: center;
}

.info { display: flex; flex-direction: column; flex-grow: 1; }

.name { font-weight: 700; font-size: 1rem; }

.meta {
    color: var(--text-sub);
    font-size: 0.85rem;
    margin-top: 4px;
    display: flex;
    gap: 10px;
    align-items: center;
}

/* HISTORY SPECIFIC */
.history-container .event-card {
    opacity: 0.8;
    border-right: 4px solid #ccc; /* RTL: Right border */
}
.loading-spinner { text-align: center; color: #888; padding: 20px; }

/* --- TABS --- */
.tabs-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    overflow-x: auto; /* Allow scrolling on small screens */
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-sub);
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Vazirmatn', sans-serif;
    white-space: nowrap;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content.hidden {
    display: none;
}

/* --- ADMIN & BUTTONS --- */
.admin-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.admin-card h3 { margin-top: 0; }

.form-group {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.action-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-family: 'Vazirmatn', sans-serif;
}

.danger-btn {
    background-color: var(--exit-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-family: 'Vazirmatn', sans-serif;
}

.hint {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
}

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 600px) {
    header {
        padding: 15px;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .control-group {
        width: 100%;
    }
    
    .control-group.grow {
        min-width: 0;
    }

    button#ack-btn {
        margin-top: 5px;
    }

    .event-icon {
        font-size: 1.5rem;
        margin-left: 10px;
        width: 30px;
    }

    .name {
        font-size: 0.95rem;
    }
    
    .meta {
        font-size: 0.75rem;
        flex-wrap: wrap;
    }
}

/* AUDIO OVERLAY */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.3s;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    max-width: 90%;
    width: 400px;
}

.overlay-content h2 {
    margin-top: 0;
    color: var(--primary-color);
}

.big-btn {
    font-size: 1.2rem;
    padding: 12px 30px;
    margin-top: 20px;
    width: 100%;
}
