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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    padding: 10px;
}

@media (min-width: 768px) {
    body {
        padding: 20px;
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

header h1 {
    font-size: 1.3rem;
    color: #667eea;
    flex: 1;
    min-width: 0;
}

@media (min-width: 768px) {
    header {
        padding: 20px 30px;
        margin-bottom: 30px;
    }
    
    header h1 {
        font-size: 2rem;
    }
}

nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
}

@media (min-width: 768px) {
    nav {
        gap: 20px;
        width: auto;
    }
}

nav a {
    text-decoration: none;
    color: #667eea;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s;
    font-size: 0.9rem;
    flex: 1;
    text-align: center;
    min-width: 80px;
}

@media (min-width: 768px) {
    nav a {
        padding: 8px 16px;
        font-size: 1rem;
        flex: none;
        min-width: auto;
    }
}

nav a:hover {
    background: #f0f0f0;
}

main {
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

@media (min-width: 768px) {
    main {
        padding: 30px;
    }
}

.schedule-section {
    margin-bottom: 40px;
}

/* Floor Plan Toggle Button */
.floor-plan-toggle-container {
    text-align: center;
    margin: 20px 0;
}

.btn-show-plan {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s;
    min-height: 44px; /* Better touch target */
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-show-plan:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.btn-show-plan:active {
    transform: translateY(0);
}

#toggle-icon {
    display: inline-block;
    transition: transform 0.3s;
    font-size: 0.9rem;
}

.btn-show-plan.expanded #toggle-icon {
    transform: rotate(180deg);
}

/* Floor Plan Image */
.floor-plan-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 30px auto;
    text-align: center;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease-out;
}

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

.floor-plan-image {
    width: 100%;
    height: auto;
    max-width: 100%;
    border-radius: 4px;
    display: block;
    object-fit: contain;
}

@media (max-width: 767px) {
    .floor-plan-toggle-container {
        margin: 15px 0;
    }
    
    .btn-show-plan {
        width: 100%;
        padding: 14px 20px;
        font-size: 0.95rem;
    }
    
    .floor-plan-container {
        padding: 8px;
        margin-bottom: 20px;
    }
    
    .floor-plan-image {
        max-width: 100%;
        height: auto;
    }
}

@media (min-width: 768px) {
    .floor-plan-container {
        padding: 20px;
    }
}

.schedule-section h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.3rem;
    text-align: center;
}

@media (min-width: 768px) {
    .schedule-section h2 {
        font-size: 1.8rem;
    }
}

.schedule-container {
    margin-bottom: 30px;
}

.schedule-courts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

@media (min-width: 768px) {
    .schedule-courts {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

.schedule-court {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    background: #fafafa;
}

@media (min-width: 768px) {
    .schedule-court {
        padding: 20px;
    }
}

.schedule-court h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.3rem;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.court-matches {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.schedule-match-item {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.schedule-match-time {
    font-weight: bold;
    color: #667eea;
    font-size: 1rem;
    margin-bottom: 5px;
}

.schedule-match-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.schedule-match-score {
    font-weight: bold;
    color: #667eea;
    font-size: 1.1rem;
}

.schedule-match-group {
    font-size: 0.85rem;
    color: #999;
    font-style: italic;
}

.groups-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .groups-container {
        grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
        gap: 30px;
    }
}

.group {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    background: #fafafa;
}

.group h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

@media (min-width: 768px) {
    .group {
        padding: 20px;
    }
    
    .group h2 {
        font-size: 1.5rem;
    }
}

.standings-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: table;
}

@media (max-width: 767px) {
    .standings-table {
        font-size: 0.75rem;
    }
    
    /* Make table scrollable on mobile */
    .group {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

.standings-table thead {
    background: #667eea;
    color: white;
}

.standings-table th,
.standings-table td {
    padding: 8px 4px;
    text-align: center;
    border: 1px solid #e0e0e0;
    white-space: nowrap;
}

@media (min-width: 768px) {
    .standings-table th,
    .standings-table td {
        padding: 10px;
    }
}

.standings-table th {
    font-weight: 600;
}

.standings-table tbody tr:nth-child(even) {
    background: #f5f5f5;
}

.standings-table tbody tr:hover {
    background: #e8e8e8;
}

.matches-section {
    margin-top: 20px;
}

.matches-section h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.matches-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.match-item {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.match-item.pending {
    opacity: 0.6;
}

.match-teams {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.match-score {
    font-weight: bold;
    color: #667eea;
    font-size: 1.1rem;
}

.match-date {
    color: #999;
    font-size: 0.85rem;
}

/* Admin Panel Styles */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
}

.admin-container h2 {
    color: #667eea;
    margin-bottom: 30px;
    font-size: 2rem;
}

.groups-admin {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .groups-admin {
        grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
        gap: 30px;
    }
}

.admin-group {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    background: #fafafa;
}

@media (min-width: 768px) {
    .admin-group {
        padding: 20px;
    }
}

.admin-group h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.admin-matches {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.admin-match {
    background: white;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.match-form {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.match-teams-info {
    flex: 1;
    min-width: 200px;
}

.match-teams-info strong {
    color: #667eea;
}

.score-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.score-inputs input {
    width: 60px;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    text-align: center;
    font-size: 1rem;
    min-height: 44px; /* Better touch target */
}

.score-inputs input:focus {
    outline: none;
    border-color: #667eea;
}

.score-inputs span {
    font-weight: bold;
    color: #667eea;
}

.btn-save {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    min-height: 44px; /* Better touch target */
    font-size: 1rem;
}

.btn-save:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.btn-save:active {
    transform: translateY(0);
}

.success-message {
    background: #4caf50;
    color: white;
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
    display: none;
}

.success-message.show {
    display: block;
}

/* Mobile Optimizations */
@media (max-width: 767px) {
    /* Header adjustments */
    header {
        flex-direction: column;
        align-items: stretch;
    }
    
    header h1 {
        text-align: center;
        font-size: 1.1rem;
        margin-bottom: 10px;
    }
    
    nav {
        justify-content: center;
    }
    
    nav a {
        font-size: 0.85rem;
        padding: 10px 8px;
        min-width: 70px;
    }
    
    /* Main content */
    main {
        padding: 10px;
    }
    
    /* Tables - horizontal scroll on mobile */
    .group {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        position: relative;
    }
    
    .standings-table {
        min-width: 600px; /* Force horizontal scroll if needed */
        width: 100%;
        display: table;
    }
    
    .standings-table th,
    .standings-table td {
        font-size: 0.7rem;
        padding: 8px 4px;
        white-space: nowrap;
    }
    
    /* Make team name column wider on mobile */
    .standings-table th:first-child,
    .standings-table td:first-child {
        min-width: 120px;
        text-align: left;
        padding-left: 8px;
    }
    
    /* Compact other columns */
    .standings-table th:not(:first-child),
    .standings-table td:not(:first-child) {
        min-width: 35px;
        text-align: center;
    }
    
    /* Match items */
    .match-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .match-teams {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .match-date {
        font-size: 0.75rem;
    }
    
    /* Admin forms */
    .match-form {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .match-teams-info {
        min-width: 100%;
        margin-bottom: 5px;
    }
    
    .score-inputs {
        width: 100%;
        justify-content: center;
    }
    
    .score-inputs input {
        flex: 1;
        max-width: 80px;
    }
    
    .btn-save {
        width: 100%;
        margin-top: 5px;
    }
    
    /* Schedule */
    .schedule-match-item {
        padding: 10px;
    }
    
    .schedule-match-teams {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    /* Group headings */
    .group h2,
    .admin-group h3 {
        font-size: 1.1rem;
    }
    
    .matches-section h3 {
        font-size: 1rem;
    }
    
    /* Container max-width */
    .container {
        padding: 0 5px;
    }
    
    /* Bracket */
    .bracket-match {
        min-width: 100%;
        margin: 10px 0;
    }
    
    .bracket-round {
        flex-direction: column;
        gap: 15px;
    }
}

/* Tablet optimizations */
@media (min-width: 768px) and (max-width: 1024px) {
    .groups-container,
    .groups-admin {
        grid-template-columns: 1fr;
    }
    
    .schedule-courts {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 40px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    line-height: 1.6;
}

footer p {
    margin: 0;
    max-width: 800px;
    margin: 0 auto;
}

@media (max-width: 767px) {
    footer {
        padding: 20px 15px;
        font-size: 0.75rem;
        margin-top: 30px;
    }
}

