/*
 * Style sheet for the hackathon voting game.
 * We use a modern aesthetic: gradients for the background, glassmorphism panels
 * with subtle transparency and blur, and smooth animations.
 */

/* Root variables for easy theme tweaking */
:root {
    --primary: #4e8cff;
    --secondary: #ff6b6b;
    --background-start: #1a2a6c;
    --background-end: #b21f1f;
    --background-third: #fdbb2d;
    --panel-bg: rgba(255, 255, 255, 0.15);
    --panel-border: rgba(255, 255, 255, 0.3);
    --text-light: #ffffff;
    --text-dark: #2c3e50;
    --radius: 16px;
    --transition: 0.3s ease;
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    font-family: 'Poppins', sans-serif;
    color: var(--text-light);
    overflow: hidden;
}

body {
    background: linear-gradient(45deg, var(--background-start), var(--background-end), var(--background-third));
    background-size: 600% 600%;
    animation: gradientShift 20s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 2rem;
}

.panel {
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    border: 1px solid var(--panel-border);
    box-shadow: var(--shadow);
    padding: 1.5rem 2rem;
    margin-bottom: 1rem;
    width: 100%;
    max-width: 800px;
    animation: fadeIn 0.6s ease;
    position: relative; /* Needed for positioning back button */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.hidden {
    display: none !important;
}

h1, h2, h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-light);
}

p {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--text-light);
}

input[type="text"], input[type="password"], select {
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: var(--radius);
    border: none;
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-dark);
    font-size: 1rem;
}

button {
    cursor: pointer;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    border: none;
    font-size: 1rem;
    transition: background var(--transition), transform var(--transition);
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

button.primary {
    background: var(--primary);
    color: var(--text-light);
}

button.secondary {
    background: var(--secondary);
    color: var(--text-light);
}

button.link {
    background: transparent;
    color: var(--primary);
    text-decoration: underline;
    padding: 0.25rem 0;
}

button:disabled {
    background: rgba(255, 255, 255, 0.3) !important;
    color: rgba(255, 255, 255, 0.6);
    cursor: not-allowed;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.room-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    max-height: 250px;
    overflow-y: auto;
}

.room-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 8px;
    background-color: #fff;
    cursor: default;
    color: var(--text-dark);
}

.room-item-controls {
    display: flex;
    gap: 8px;
}

.room-item-controls button {
    margin: 0;
    padding: 6px 12px;
    font-size: 0.9em;
}

button.danger {
    background-color: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

button.danger:hover {
    background-color: #c0392b;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-header h2 {
    margin: 0;
}

.back-btn {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-light);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    padding: 0;
    margin: 0;
    text-decoration: none;
    border: 1px solid transparent;
    flex-shrink: 0; /* Prevent the button from shrinking */
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-group {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.team-list, .team-selector {
    margin-bottom: 1rem;
}

.team-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.team-item input {
    flex: 1;
    margin-right: 0.5rem;
}

.remove-team {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-light);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
}

.dashboard-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}

.dashboard-left {
    flex: 1 1 300px;
}

.dashboard-right {
    flex: 1 1 300px;
}

.timer-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#timerDisplay, #playerTimer {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: 2px;
}

.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.tab {
    flex: 1;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius);
    padding: 0.5rem;
    text-align: center;
    color: var(--text-light);
    cursor: pointer;
    border: 1px solid transparent;
    transition: background var(--transition), border var(--transition);
}

.tab.active, .tab:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.5);
}

.tab-content {
    max-height: 400px;
    overflow-y: auto;
}

.leader-row, .result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.bar-container {
    position: relative;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.25rem;
}

.bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--primary);
    width: 0;
    transition: width 1s ease;
}

.stars {
    display: flex;
    flex-direction: row-reverse; /* Reverse the display order */
    justify-content: flex-end;  /* Align to the right */
    gap: 0.25rem;
}

.stars input {
    display: none;
}

.stars label {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: color var(--transition);
}

.stars label:hover,
.stars label:hover ~ label,
.stars input:checked ~ label {
    color: var(--secondary);
}

.rating-item {
    margin-bottom: 1rem;
}

.rating-item h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 500;
}

/* Leaderboard styling */
.medal {
    width: 24px;
    height: 24px;
    margin-right: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dashboard-columns {
        flex-direction: column;
    }
}