/* ============================================================
   booths.libidoadultshop.com.au -- Dashboard Styles
   ============================================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg:           #0f1117;
    --surface:      #1a1d27;
    --surface-2:    #22263a;
    --border:       #2e3250;
    --text:         #e2e4f0;
    --text-muted:   #6b7099;
    --accent:       #7b68ee;

    --green:        #2ecc71;
    --green-bg:     rgba(46, 204, 113, 0.1);
    --blue:         #3498db;
    --blue-bg:      rgba(52, 152, 219, 0.1);
    --amber:        #f39c12;
    --amber-bg:     rgba(243, 156, 18, 0.1);
    --red:          #e74c3c;
    --red-bg:       rgba(231, 76, 60, 0.1);
    --grey:         #6b7099;
    --grey-bg:      rgba(107, 112, 153, 0.1);

    --radius:       10px;
    --radius-sm:    6px;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* -- Header -- */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.site-header h1 {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.header-sub {
    margin-left: 0.75rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.header-user {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* -- Main -- */
main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* -- Summary bar -- */
.summary-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.summary-item--right {
    margin-left: auto;
    text-align: right;
}

.summary-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.summary-value {
    font-size: 1.3rem;
    font-weight: 700;
}

.summary-value--small {
    font-size: 0.9rem;
    font-weight: 400;
}

/* -- Booth grid -- */
.booth-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

/* -- Booth card -- */
.booth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.2s;
}

/* Active: green -- session credit is still running */
.booth-card--active { border-top: 3px solid var(--green); }
/* Recent: blue -- session just ended */
.booth-card--recent { border-top: 3px solid var(--blue);  }
.booth-card--idle   { border-top: 3px solid var(--amber); }
.booth-card--silent { border-top: 3px solid var(--red);   }
.booth-card--never  { border-top: 3px solid var(--grey);  }

/* Coin mech offline: flashing red -- TL6-USB dongle not detected */
.booth-card--mechoffline {
    border-top: 3px solid var(--red);
    animation: mech-offline-flash 1.0s ease-in-out infinite;
}

.booth-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.booth-name {
    font-weight: 600;
    font-size: 1rem;
}

/* -- Status badges -- */
.booth-status-badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.55rem;
    border-radius: 99px;
}

.badge--active { background: var(--green-bg); color: var(--green); }
.badge--recent { background: var(--blue-bg);  color: var(--blue);  }
.badge--idle   { background: var(--amber-bg); color: var(--amber); }
.badge--silent { background: var(--red-bg);   color: var(--red);   }
.badge--never  { background: var(--grey-bg);  color: var(--grey);  }
.badge--mechoffline { background: var(--red-bg); color: var(--red); animation: mech-offline-flash 1.0s ease-in-out infinite; }

@keyframes mech-offline-flash {
    0%, 100% { opacity: 1;   border-top-color: var(--red); }
    50%       { opacity: 0.4; border-top-color: transparent; }
}

/* -- Booth stats -- */
.booth-card__body {
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.booth-stat {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.875rem;
}

.stat-label {
    color: var(--text-muted);
}

.stat-value {
    font-weight: 500;
}

.stat-value--muted {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: monospace;
}

/* -- Footer -- */
.site-footer {
    display: flex;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

/* -- Login page -- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 380px;
}

.login-box h1 {
    font-size: 1.4rem;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus {
    border-color: var(--accent);
}

.btn {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s;
}

.btn:hover { opacity: 0.85; }

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-block {
    width: 100%;
    margin-top: 0.5rem;
}

/* -- Alerts -- */
.alert {
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.alert-error {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid var(--red);
}

/* ----------------------------------------------------------
   Coin flash -- green pulse on card background when a new
   coin event arrives (v8: changed from gold to green)
   ---------------------------------------------------------- */
@keyframes coin-flash {
    0%   { box-shadow: 0 0 0 0   rgba(46, 204, 113, 0.0);  }
    20%  { box-shadow: 0 0 0 8px rgba(46, 204, 113, 0.55); background-color: rgba(46, 204, 113, 0.08); }
    100% { box-shadow: 0 0 0 0   rgba(46, 204, 113, 0.0);  background-color: transparent; }
}

.booth-card.coin-flash {
    animation: coin-flash 1.2s ease-out forwards;
}

/* ----------------------------------------------------------
   Connection status indicator (#sse-status)
   Optional -- only visible if the element exists in index.php
   ---------------------------------------------------------- */
#sse-status {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 99px;
    display: inline-block;
}

#sse-status.sse-live {
    color: #1E7D46;
    background: rgba(30, 125, 70, 0.12);
}

#sse-status.sse-reconnecting {
    color: #9B2626;
    background: rgba(155, 38, 38, 0.12);
    animation: blink 1.2s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1;   }
    50%       { opacity: 0.4; }
}