html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    width: 100%;
    font-family: Arial, sans-serif;
}

.navbar {
    background-color: #2c3e50;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    width: 100vw;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.nav-brand {
    color: #ecf0f1;
    font-size: 1.5rem;
    font-weight: bold;
    margin-left: 20px;
    padding: 1rem 0;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    display: inline;
}

.nav-brand a {
    color: #ecf0f1;
    text-decoration: none;
    padding: 1rem 0.5rem;
    display: inline-block;
    transition: color 0.3s ease;
}

.nav-menu a {
    color: #ecf0f1;
    text-decoration: none;
    padding: 1rem 0.5rem;
    display: inline-block;
    margin-right: 20px;
    transition: color 0.3s ease;
}

.nav-menu a:hover {
    color: #3498db;
}

/* .nav-menu .login-btn {
    background-color: #3498db;
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    color: white;
} */

/* .nav-menu .login-btn:hover {
    background-color: #2980b9;
    color: white;
} */

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    box-sizing: border-box;
}
.iframe-container {
    width: 90vw;
    height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
}
iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}
.content-section {
    width: 90vw;
    max-width: 800px;
    margin: 2rem auto;
    display: none;
}

.login-container {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.login-container h2 {
    margin-top: 0;
    color: #2c3e50;
}

.login-container p {
    color: #7f8c8d;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.submit-btn {
    background-color: #3498db;
    color: white;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.submit-btn:hover:not(:disabled) {
    background-color: #2980b9;
}

.submit-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.message {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 0.95rem;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

footer {
    width: 100%;
    text-align: center;
    margin-top: 20px;
}

.admin-panel {
    margin-top: 2rem;
}

.admin-panel h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

#users-list-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.users-table thead {
    background-color: #2c3e50;
    color: white;
}

.users-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.users-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #ecf0f1;
}

.users-table tbody tr:hover {
    background-color: #f8f9fa;
}

.users-table tbody tr:last-child td {
    border-bottom: none;
}

.user-auth-badge {
    display: block;
    background-color: #3498db;
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.85rem;
    margin-right: 0.3rem;
    margin-bottom: 0.3rem;
}

.user-auth-badge.admin {
    background-color: #e74c3c;
}

.user-auth-badge.contributor {
    background-color: #f39c12;
}

.user-auth-badge.viewer {
    background-color: #2ecc71;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    max-width: 25%;
    cursor: pointer;
}

.add-user-form {
    margin-top: 2rem;
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.add-user-form h3 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.add-user-form p {
    color: #7f8c8d;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.add-game-section {
    margin-top: 2rem;
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.add-game-section h3 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.add-game-section p {
    color: #7f8c8d;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.add-game-by-bgg-section {
    margin-top: 2rem;
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.add-game-by-bgg-section h3 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.add-game-by-bgg-section p {
    color: #7f8c8d;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.csv-upload-section {
    margin-top: 2rem;
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.csv-upload-section h3 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.csv-upload-section p {
    color: #7f8c8d;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.csv-upload-section .form-group input[type="file"] {
    background: white;
    cursor: pointer;
}

.csv-upload-section .form-group input[type="file"]::-webkit-file-upload-button {
    background-color: #95a5a6;
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 1rem;
}

.csv-upload-section .form-group input[type="file"]::-webkit-file-upload-button:hover {
    background-color: #7f8c8d;
}

#csv-upload-message {
    white-space: pre-line;
}
/* Games Grid Styles */
#games-grid-container {
    margin-top: 2rem;
}

.games-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.games-count {
    font-size: 1rem;
    color: #2c3e50;
    font-weight: 500;
}

.games-sort {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.games-sort label {
    font-size: 0.95rem;
    color: #2c3e50;
    font-weight: 500;
}

.games-sort select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.games-sort select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.sort-direction-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    transition: all 0.3s ease;
}

.sort-direction-btn:hover {
    background: #ecf0f1;
    border-color: #3498db;
}

.sort-direction-btn:active {
    transform: scale(0.95);
}

.games-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.game-card-container {
    perspective: 1000px;
    min-height: 280px;
    width: 100%;
}

.game-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.6s, box-shadow 0.3s;
    transform-style: preserve-3d;
    position: relative;
    min-height: 280px;
    cursor: pointer;
    width: 100%;
}

.game-card.flipped {
    transform: rotateY(180deg);
}

.game-card-front,
.game-card-back {
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
    box-sizing: border-box;
}

.game-card-front {
    z-index: 2;
    display: flex;
    flex-direction: row-reverse;
    align-items: stretch;
    min-height: 280px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.game-card-container:hover .game-card {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.game-card-back {
    transform: rotateY(180deg);
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.game-card-back-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.game-card-back-description {
    flex: 1;
    overflow-y: auto;
    margin: 1rem 0;
}

.game-card-back-description p {
    margin: 0;
    line-height: 1.6;
    color: #2c3e50;
}

.game-card-back-footer {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid #ecf0f1;
    margin-top: auto;
}

.flip-hint {
    font-size: 0.85rem;
    color: #7f8c8d;
    font-style: italic;
}

.game-card-image {
    width: 30%;
    min-height: 280px;
    background-size: contain;
    /* background-position: center; */
    background-repeat: no-repeat;
    background-color: #f8f9fa;
    display: flex;
    /* align-items: center;
    justify-content: center; */
    color: white;
    font-size: 3rem;
    overflow: hidden;
    flex-shrink: 0;
}

.game-card-content {
    padding: 1.25rem;
    padding-bottom: 3rem;
    width: 60%;
    box-sizing: border-box;
    position: relative;
}

.game-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 0.5rem 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-card-owner {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin: 0 0 0.75rem 0;
}

.game-card-details {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.game-card-detail {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9rem;
    color: #2c3e50;
}

.game-card-detail-icon {
    font-weight: 600;
}

.game-card-description {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin: 0.75rem 0 0 0;
    line-height: 1.4;
}

.game-card-short-description {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin: 0.75rem 0 0 0;
    line-height: 1.4;
}

.game-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.game-tag {
    display: inline-block;
    background-color: #ecf0f1;
    color: #2c3e50;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
}

.game-card-rating {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9rem;
    color: #f39c12;
    font-weight: 600;
    margin-top: 0.75rem;
}

.game-card-link {
    margin-top: 0.5rem;
}

.game-card-link a {
    color: #3498db;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.game-card-link a:hover {
    color: #2980b9;
    text-decoration: underline;
}

.game-card-delete-btn {
    position: absolute;
    bottom: 0;
    left: 0;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 0 4px 0 0;
    width: 36px;
    height: 36px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10;
}

.game-card-delete-btn:hover {
    background-color: #c0392b;
    transform: scale(1.1);
}

.game-card-delete-btn:active {
    transform: scale(0.95);
}

/* Pagination Styles */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding: 1rem;
}

.pagination-btn {
    background-color: #ecf0f1;
    color: #2c3e50;
    border: 1px solid #bdc3c7;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    font-size: 0.95rem;
}

.pagination-btn:hover:not(:disabled) {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

.pagination-btn:disabled {
    background-color: #ecf0f1;
    color: #95a5a6;
    cursor: not-allowed;
    opacity: 0.6;
}

.pagination-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

.pagination-info {
    font-size: 0.95rem;
    color: #2c3e50;
    padding: 0 0.5rem;
}

/* Mobile Responsive Styles */
@media screen and (max-width: 768px) {
    /* Base font size increase for better readability */
    body {
        font-size: 16px;
    }

    /* Navigation */
    .nav-container {
        flex-direction: column;
        padding: 0 10px;
    }

    .nav-brand {
        margin-left: 0;
        padding: 0.75rem 0;
        font-size: 1.25rem;
    }

    .nav-menu {
        flex-direction: column;
        gap: 0;
        width: 100%;
        text-align: center;
    }

    .nav-menu li {
        width: 100%;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-menu a {
        display: block;
        padding: 0.75rem 1rem;
        margin-right: 0;
    }

    /* Content sections */
    .content-section {
        width: 95vw;
        margin: 1rem auto;
    }

    .login-container,
    .add-user-form,
    .add-game-section,
    .csv-upload-section {
        padding: 1.25rem;
    }

    /* Form inputs - increase size for mobile */
    .form-group input,
    .form-group select,
    .games-sort select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.875rem;
    }

    .submit-btn {
        width: 100%;
        padding: 0.875rem;
        font-size: 1rem;
    }

    /* Games Grid */
    .games-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .games-sort {
        flex-direction: column;
        gap: 0.5rem;
    }

    .games-sort label {
        text-align: left;
    }

    .games-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .game-card-container {
        min-height: 750px;
    }

    .game-card {
        min-height: 750px;
    }

    .game-card-front {
        flex-direction: column;
        min-height: 750px;
    }

    .game-card-back {
        min-height: 750px;
    }

    .game-card-image {
        width: 100%;
        min-height: 500px;
        background-position: center;
    }

    .game-card-content {
        width: 100%;
        padding: 1rem;
        padding-bottom: 3rem;
    }

    .game-card-title {
        font-size: 1.15rem;
        white-space: normal;
    }

    .game-card-details {
        flex-direction: column;
        gap: 0.5rem;
    }

    .game-card-delete-btn {
        bottom: 0;
        left: 0;
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
        border-radius: 0 4px 0 0;
    }

    /* Tables - make scrollable on mobile */
    #users-list-container {
        overflow-x: auto;
        padding: 1rem;
    }

    .users-table {
        min-width: 600px;
    }

    .users-table th,
    .users-table td {
        padding: 0.65rem 0.5rem;
        font-size: 0.9rem;
    }

    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        gap: 0.3rem;
    }

    .pagination-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }

    .pagination-info {
        width: 100%;
        text-align: center;
        padding: 0.5rem 0;
    }

    /* Checkbox groups */
    .checkbox-group input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }

    /* iframe container */
    .iframe-container {
        width: 95vw;
        height: 85vh;
        margin-top: 10px;
    }
}

/* Extra small devices (phones in portrait, less than 576px) */
@media screen and (max-width: 576px) {
    .nav-brand {
        font-size: 1.1rem;
    }

    .game-card-title {
        font-size: 1rem;
    }

    .game-card-content {
        padding: 0.875rem;
    }

    .login-container h2,
    .add-user-form h3,
    .add-game-section h3,
    .csv-upload-section h3 {
        font-size: 1.25rem;
    }
}