/* HomeControlPanel styles */

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

body {
    font-family: sans-serif;
    background: #1a1a1a;
    color: #e0e0e0;
    min-height: 100vh;
    padding: 0 0 2rem;
}

header {
    background: #222;
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid #333;
}

header h1 {
    font-size: 1.3rem;
    color: #e0e0e0;
}

main {
    max-width: 420px;
    margin: 0 auto;
    padding: 1rem;
}

section {
    background: #222;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

h2 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: #aaa;
}

h3 {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    color: #777;
}

.hidden {
    display: none !important;
}

/* Disabled overlay for sections when standby */
.disabled-overlay {
    position: relative;
}

.disabled-overlay.standby {
    opacity: 0.3;
    pointer-events: none;
}

/* ---- Auth section ---- */
#authSection label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
    color: #888;
}

.token-row {
    display: flex;
    gap: 0.5rem;
}

.token-row input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #444;
    border-radius: 4px;
    background: #1a1a1a;
    color: #e0e0e0;
    font-size: 0.9rem;
}

.token-row button {
    padding: 0.5rem 1rem;
    border: 1px solid #444;
    border-radius: 4px;
    background: #333;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 0.9rem;
}

.token-row button:hover {
    background: #444;
}

.hint {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.3rem;
}

/* ---- Power ---- */
.power-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.power-btn {
    padding: 0.75rem 2rem;
    border: 2px solid #555;
    border-radius: 8px;
    background: #333;
    color: #e0e0e0;
    font-size: 1.1rem;
    cursor: pointer;
    font-weight: bold;
}

.power-btn:hover {
    background: #444;
}

.power-btn.on {
    border-color: #4caf50;
    color: #4caf50;
}

.power-btn.off {
    border-color: #666;
    color: #888;
}

.power-state {
    font-size: 0.85rem;
    color: #888;
}

/* ---- Volume bar ---- */
.volume-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.vol-btn {
    width: 48px;
    height: 48px;
    border: 1px solid #444;
    border-radius: 50%;
    background: #333;
    color: #e0e0e0;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.vol-btn:hover {
    background: #444;
}

.vol-btn:active {
    background: #555;
}

.volume-display {
    flex: 1;
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
    color: #e0e0e0;
}

.volume-display.muted {
    color: #c62828;
}

.mute-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #444;
    border-radius: 6px;
    background: #333;
    color: #e0e0e0;
    font-size: 0.85rem;
    cursor: pointer;
}

.mute-btn:hover {
    background: #444;
}

.mute-btn.active {
    background: #c62828;
    border-color: #c62828;
    color: #fff;
}

/* ---- Cursor / Nav grid ---- */
.cursor-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.cursor-top,
.cursor-mid,
.cursor-bot {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.25rem;
    width: 100%;
    max-width: 280px;
}

.cursor-top > *,
.cursor-mid > *,
.cursor-bot > * {
    display: flex;
    align-items: center;
    justify-content: center;
}

.arrow-btn {
    width: 56px;
    height: 56px;
    border: 1px solid #444;
    border-radius: 8px;
    background: #333;
    color: #e0e0e0;
    font-size: 1.3rem;
    cursor: pointer;
    justify-self: center;
}

.arrow-btn:hover {
    background: #444;
}

.arrow-btn:active {
    background: #555;
}

.select-btn {
    width: 64px;
    height: 56px;
    border: 2px solid #555;
    border-radius: 8px;
    background: #3a3a3a;
    color: #e0e0e0;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    justify-self: center;
}

.select-btn:hover {
    background: #4a4a4a;
}

.nav-btn {
    padding: 0.4rem 0.6rem;
    border: 1px solid #444;
    border-radius: 6px;
    background: #333;
    color: #aaa;
    font-size: 0.8rem;
    cursor: pointer;
    justify-self: center;
}

.nav-btn:hover {
    background: #444;
    color: #e0e0e0;
}

/* ---- Input grid ---- */
.input-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.input-btn {
    flex: 1 1 calc(33% - 0.5rem);
    min-width: 70px;
    padding: 0.65rem 0.5rem;
    border: 1px solid #444;
    border-radius: 6px;
    background: #333;
    color: #e0e0e0;
    font-size: 0.9rem;
    cursor: pointer;
    text-align: center;
}

.input-btn:hover {
    background: #444;
}

.input-btn.active {
    background: #1565c0;
    border-color: #1565c0;
    color: #fff;
}

/* ---- AirPlay controls ---- */
.airplay-controls {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

.ap-btn {
    width: 56px;
    height: 48px;
    border: 1px solid #444;
    border-radius: 8px;
    background: #333;
    color: #e0e0e0;
    font-size: 1rem;
    cursor: pointer;
}

.ap-btn:hover {
    background: #444;
}

.ap-btn:active {
    background: #555;
}

/* ---- Feedback ---- */
#feedbackMsg {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    text-align: center;
    border: 1px solid #444;
    border-radius: 4px;
}

#feedbackMsg.success {
    background: #1b3a1b;
    color: #66bb6a;
    border-color: #2e7d32;
}

#feedbackMsg.error {
    background: #3a1b1b;
    color: #ef5350;
    border-color: #c62828;
}

/* Sending state */
button.sending {
    opacity: 0.5;
    pointer-events: none;
}

/* ---- Status section ---- */
.status-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    font-size: 0.9rem;
}

.status-row .label {
    color: #888;
}

#agentStatus.recent { color: #4caf50; }
#agentStatus.stale  { color: #e65100; }
#agentStatus.unknown { color: #666; }

#lastResultBlock {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    font-size: 0.85rem;
}

.status-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.7rem 0;
}

.status-actions button {
    padding: 0.4rem 0.8rem;
    border: 1px solid #444;
    border-radius: 4px;
    background: #333;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 0.85rem;
}

.status-actions button:hover {
    background: #444;
}

.status-actions label {
    font-size: 0.85rem;
    color: #888;
    cursor: pointer;
}

/* ---- Command history list ---- */
.command-list {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
    font-size: 0.82rem;
}

.command-list li {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #333;
}

.command-list li.empty {
    color: #666;
    text-align: center;
}

.command-list .status-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    font-size: 0.75rem;
    margin-left: 0.3rem;
    border: 1px solid #444;
    border-radius: 3px;
    background: #2a2a2a;
}

.status-badge.pending    { color: #888; }
.status-badge.dispatched { color: #42a5f5; }
.status-badge.completed  { color: #66bb6a; }
.status-badge.failed     { color: #ef5350; }
