@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&family=Fredoka+One&display=swap');

:root {
    --primary-color: #1a365d;
    --secondary-color: #2b6cb0;
    --accent-color: #f6e05e;
    /* Sky blue → royal blue gradient */
    --background-color: linear-gradient(180deg, #87CEEB 0%, #66A3FF 55%, #4169E1 100%);
    --text-color: #2d3748;
    --text-light: #4a5568;
    --white: #ffffff;
    --border-radius: 16px;
    --box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Team Colors */
    --team-aubergine: #7e3f8f;
    --team-tomato: #e74c3c;
    --team-carrot: #e67e22;
    --team-avocado: #27ae60;
    
    /* Gradients */
    --gradient-aubergine: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    --gradient-tomato: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    --gradient-carrot: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    --gradient-avocado: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    
    /* Background Gradients (subtle overlay) */
    --bg-gradient: linear-gradient(135deg, #87CEEB, #4169E1);
    --modal-overlay: rgba(0, 0, 0, 0.7);
}

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

/* Ensure the document can scroll */
html, body {
    height: auto;
    overflow-y: auto;
    overflow-x: hidden; /* prevent horizontal overflow strips */
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    background-attachment: fixed;
    background-size: cover;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-gradient);
    z-index: -1;
    opacity: 0.1;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
}

main {
    padding: 5rem 1rem 5rem;
    max-width: 100%;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Page transition animations */
@keyframes slideInFromRight { from { transform: translateX(30%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideInFromLeft  { from { transform: translateX(-30%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOutToLeft   { from { transform: translateX(0); opacity: 1; } to { transform: translateX(-30%); opacity: 0; } }
@keyframes slideOutToRight  { from { transform: translateX(0); opacity: 1; } to { transform: translateX(30%); opacity: 0; } }

.slide-in-right { animation: slideInFromRight 300ms ease both; }
.slide-in-left  { animation: slideInFromLeft  300ms ease both; }
.slide-out-left { animation: slideOutToLeft   250ms ease both; }
.slide-out-right{ animation: slideOutToRight  250ms ease both; }

/* What's On - Event list */
.whats-on-container {
    max-width: 900px;
    margin: 0 auto;
}

.page-title {
    background: #ffffff;
    color: var(--primary-color);
    border-radius: 14px;
    padding: 12px 16px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    border: 1px solid #e6edf5;
    margin-bottom: 12px;
    font-size: 1.4rem;
}

.day-group {
    margin-top: 16px;
}

.day-title {
    background: #ffffff;
    color: var(--primary-color);
    border-radius: 12px;
    padding: 10px 14px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    border: 1px solid #e6edf5;
    font-weight: 700;
    margin-bottom: 8px;
}

.events-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.event-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    border: 1px solid #e6edf5;
}

.event-card.live { border-left: 5px solid #38a169; }
.event-card.endedVoting { border-left: 5px solid #d69e2e; }
.event-card.upcoming { border-left: 5px solid #4299e1; }
.event-card.finalized { border-left: 5px solid #718096; opacity: 0.7; }

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.event-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--primary-color);
}

.event-time {
    font-size: 0.9rem;
    color: var(--text-light);
}

.event-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    gap: 8px;
}

.event-location {
    color: var(--text-light);
    font-size: 0.95rem;
}

.event-actions .btn {
    padding: 8px 12px;
    border-radius: 10px;
}

.btn.btn-live {
    background: #38a169;
    color: white;
}

.voting-controls {
    margin-top: 10px;
    background: #f7fafc;
    border: 1px solid #edf2f7;
    border-radius: 12px;
    padding: 10px;
}

.emoji-votes {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.emoji-btn {
    font-size: 20px;
    line-height: 1;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: white;
}

.emoji-btn:disabled {
    opacity: 0.4;
    filter: grayscale(100%);
    cursor: not-allowed;
}

/* Header Styles */
.app-header {
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 6px 0;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transform: translateY(0);
    transition: transform 0.3s ease, background 0.3s ease;
    border-bottom: 1px solid #edf2f7;
}

.app-header.hidden {
    transform: translateY(-100%);
}

.logo-container {
    max-width: 100px; /* much smaller */
    margin: 0 auto;
    padding: 2px 10px;
    background: transparent;
    transition: all 0.3s ease;
}

.app-logo {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    box-shadow: none;
    transition: all 0.3s ease;
    border: none;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--modal-overlay);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Content */
.modal-content {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    position: relative;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
    opacity: 1;
}

/* PIN Input */
.pin-input {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 2rem 0;
}

.pin-input input {
    width: 50px;
    height: 60px;
    text-align: center;
    font-size: 1.5rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.pin-input input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2);
    outline: none;
}

.pin-input input.filled {
    border-color: var(--primary-color);
}

.pin-error {
    color: #e74c3c;
    text-align: center;
    min-height: 24px;
    margin-top: 10px;
    font-weight: 500;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-family: 'Poppins', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

.nav-btn.active {
    background: var(--accent-color);
    color: #000;
    font-weight: 700;
    transform: translateY(-5px);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.1);
}

.nav-btn i {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.nav-btn span {
    font-size: 0.7rem;
    white-space: nowrap;
}

.nav-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.nav-btn:active {
    transform: translateY(0) !important;
}

.btn-primary {
    background: var(--accent-color);
    color: #000;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.1);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

@keyframes slideUp {
    from { transform: translateY(0); }
    to { transform: translateY(-100%); }
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 100px 20px 120px; /* top for fixed header, bottom for fixed nav */
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    background: transparent; /* let the body gradient show through */
    box-shadow: none;
    border-radius: var(--border-radius);
    margin: 20px auto;
}

/* Ensure the last element in main clears the bottom nav */
.main-content > *:last-child {
    margin-bottom: 140px;
}

/* App Footer (footnote) */
.app-footer {
    text-align: center;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.9);
    margin: 10px auto 90px; /* sit above fixed bottom nav */
    padding: 8px 12px;
    max-width: 1200px;
    text-wrap: balance;
}

.app-footer a {
    color: #fff;
    text-decoration: underline;
}

/* Footer icon to match text size */
.app-footer .footer-icon {
    height: 1em;       /* match current text size */
    width: auto;
    vertical-align: text-bottom;
    margin-left: 6px;
    border-radius: 3px;
}

@media (max-width: 768px) {
    .app-footer { margin-bottom: 100px; }
}

/* Admin Panel */
.admin-panel {
    max-width: 600px;
    margin: 20px auto;
    padding: 0;
    background: transparent;
}

/* Admin Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    text-align: center;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-content h2 {
    margin-top: 0;
    color: var(--primary-color);
    font-family: 'Fredoka One', cursive;
}

/* PIN Input */
.pin-input-container {
    margin: 20px 0;
}

.pin-input {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

.pin-input input {
    width: 50px;
    height: 60px;
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.pin-input input:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.2);
    outline: none;
}

.pin-input input.filled {
    border-color: var(--accent-color);
    background-color: #fffaf0;
}

.pin-error {
    color: #e53e3e;
    margin-top: 10px;
    min-height: 20px;
    font-weight: 500;
}

/* Admin Controls */
.admin-controls {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
}

.admin-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #edf2f7;
}

.admin-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.admin-section h2 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 20px;
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
}

.danger-zone {
    background: #fff5f5;
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px dashed #fc8181;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-color);
    color: var(--primary-color);
    box-shadow: 0 4px 0 #d69e2e;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #d69e2e;
}

.btn-primary:active {
    transform: translateY(1px);
    box-shadow: 0 2px 0 #d69e2e;
}

.btn-secondary {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-danger {
    background: #e53e3e;
    color: white;
    box-shadow: 0 4px 0 #c53030;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #c53030;
}

.btn-danger:active {
    transform: translateY(1px);
    box-shadow: 0 2px 0 #c53030;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0.5rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: none;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
    max-width: 600px;
    margin: 0 auto;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 16px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    min-width: 60px;
    position: relative;
    overflow: hidden;
    border: none;
    outline: none;
}

.nav-btn::after {
    content: '';
    position: absolute;
    bottom: -10px;
    width: 6px;
    height: 6px;
    background: var(--accent-color);
    border-radius: 50%;
    opacity: 0;
    transition: all 0.3s ease;
}

.nav-btn.active {
    color: white;
    transform: translateY(-5px);
}

.nav-btn.active::after {
    opacity: 1;
    bottom: 0;
}

.nav-btn i {
    font-size: 20px;
    margin-bottom: 2px;
}

/* Team Cards */
.team-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--box-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    border-left: 5px solid;
}

.team-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.team-card h3 {
    margin: 0 0 10px 0;
    font-size: 1.4rem;
    font-weight: 700;
}

.team-card .score {
    font-size: 2.5rem;
    font-weight: 800;
    text-align: center;
    margin: 10px 0;
    font-family: 'Fredoka One', cursive;
}

/* Team specific styles */
.team-aubergine { border-left-color: var(--team-aubergine); }
.team-tomato { border-left-color: var(--team-tomato); }
.team-carrot { border-left-color: var(--team-carrot); }
.team-avocado { border-left-color: var(--team-avocado); }

.team-aubergine .score { color: var(--team-aubergine); }
.team-tomato .score { color: var(--team-tomato); }
.team-carrot .score { color: var(--team-carrot); }
.team-avocado .score { color: var(--team-avocado); }

/* Team Colors */
.team-aubergine { color: #800080; }
.team-tomato { color: #FF6347; }
.team-carrot { color: #FFA500; }
.team-avocado { color: #556B2F; }

/* Loading State */
#loading {
    text-align: center;
    padding: 20px;
    font-size: 1.2em;
    color: #666;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        margin: 10px;
        padding: 90px 15px 120px;
    }
    
    .nav-btn {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .logo-container { max-width: 90px; }
}

/* Utility Classes */
.hidden {
    display: none !important;
}
