* {
    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, #3D348B 0%, #7678ED 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

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

h1 {
    color: white;
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.header-bar h1 {
    margin-bottom: 0;
    flex: 1;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-settings,
.btn-login,
.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-block;
}

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

.btn-logout {
    background: rgba(220, 53, 69, 0.2);
    border-color: rgba(220, 53, 69, 0.3);
}

.btn-logout:hover {
    background: rgba(220, 53, 69, 0.3);
    border-color: rgba(220, 53, 69, 0.5);
}

.login-prompt {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.login-prompt p {
    font-size: 1.1em;
    color: #555;
    margin: 0;
}

.login-prompt a {
    color: #7678ED;
    text-decoration: none;
    font-weight: 600;
}

.login-prompt a:hover {
    text-decoration: underline;
}

h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
}

/* Form Container */
.form-container {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.form-container.collapsed {
    padding: 20px 30px;
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.form-container.collapsed .form-header {
    margin-bottom: 0;
}

.btn-toggle-form {
    background: transparent;
    border: 2px solid #7678ED;
    color: #7678ED;
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-toggle-form:hover {
    background: #7678ED;
    color: white;
}

.toggle-icon {
    font-size: 14px;
    transition: transform 0.3s;
}

.form-content {
    transition: all 0.3s ease;
}

.add-game-prompt {
    text-align: center;
    margin-bottom: 30px;
}

.add-game-prompt .btn {
    font-size: 18px;
    padding: 15px 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #7678ED;
}

/* Players Range */
.players-range {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.players-group {
    flex: 1;
    min-width: 120px;
}

.players-separator {
    color: #666;
    font-weight: 600;
    padding-bottom: 8px;
    align-self: flex-end;
}

/* Game Type Badge */
.game-type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
}

.game-type-competitive {
    background: #f8d7da;
    color: #721c24;
}

.game-type-collaborative {
    background: #d1ecf1;
    color: #0c5460;
}

/* Gameplay Checkboxes */
.gameplay-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    max-height: 300px;
    overflow-y: auto;
}

.gameplay-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    background: white;
    border-radius: 5px;
    border: 1px solid #dee2e6;
    transition: all 0.2s;
}

.gameplay-checkbox-label:hover {
    background: #e7f3ff;
    border-color: #7678ED;
}

.gameplay-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
    flex-shrink: 0;
}

.gameplay-checkbox-label span {
    font-size: 14px;
    color: #333;
}

.gameplay-checkbox-label input[type="checkbox"]:checked + span {
    font-weight: 600;
    color: #7678ED;
}

/* Gameplay Badges */
.gameplay-badge {
    display: inline-block;
    padding: 3px 10px;
    margin: 3px 5px 3px 0;
    border-radius: 12px;
    background: #e9ecef;
    color: #495057;
    font-size: 12px;
    font-weight: 500;
}

.token-input {
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.form-help {
    display: block;
    margin-top: 5px;
    font-size: 13px;
    color: #666;
    font-style: italic;
}

.form-help code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.info-box {
    background: #E7E8FD;
    border: 2px solid #7678ED;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    color: #3D348B;
}

.info-box p {
    margin-bottom: 10px;
}

.info-box ul {
    margin: 10px 0 10px 20px;
}

.info-box li {
    margin-bottom: 5px;
}

.info-box a {
    color: #7678ED;
    text-decoration: underline;
}

.info-box a:hover {
    color: #5F60D6;
}

.info-box.success-box {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.info-box.warning-box {
    background: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
}

/* BGG Search */
.bgg-search-container,
.barcode-container {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.bgg-search-container input[type="text"],
.barcode-container input[type="text"] {
    flex: 1;
}

.btn-barcode {
    background: #F18701;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    transition: background 0.3s;
}

.btn-barcode:hover {
    background: #D87501;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(241, 135, 1, 0.4);
}

.btn-webcam {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    transition: background 0.3s;
}

.btn-webcam:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

/* Webcam Scanner Modal */
.webcam-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

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

.webcam-modal-content {
    background: white;
    border-radius: 12px;
    padding: 0;
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s;
}

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

.webcam-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.webcam-modal-header h3 {
    margin: 0;
    color: #333;
}

.webcam-close {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.webcam-close:hover {
    background: #f0f0f0;
    color: #333;
}

.webcam-modal-body {
    padding: 20px;
    text-align: center;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.webcam-controls {
    width: 100%;
    text-align: left;
}

.webcam-select {
    background: white;
    cursor: pointer;
}

.webcam-select:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.webcam-status {
    font-size: 16px;
    color: #666;
    margin-bottom: 20px;
    min-height: 24px;
}

.webcam-error {
    color: #e74c3c;
    background: #fee;
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    border: 1px solid #fcc;
}

.webcam-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #e0e0e0;
}

#webcamVideo {
    background: #000;
    border: 2px solid #3498db;
}

@media (max-width: 768px) {
    .webcam-modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .webcam-modal-header h3 {
        font-size: 18px;
    }
}

.btn-bgg {
    background: #F18701;
    color: white;
    white-space: nowrap;
    padding: 12px 20px;
}

.btn-bgg:hover {
    background: #D87501;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(241, 135, 1, 0.4);
}

.bgg-results {
    margin-top: 10px;
    padding: 15px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.bgg-loading {
    color: #7678ED;
    font-weight: 600;
    text-align: center;
    padding: 10px;
}

.bgg-error {
    color: #dc3545;
    font-weight: 600;
    padding: 10px;
    background: #f8d7da;
    border-radius: 5px;
}

.bgg-success {
    color: #28a745;
    font-weight: 600;
    padding: 10px;
    background: #d4edda;
    border-radius: 5px;
}

.bgg-results-list {
    color: #333;
}

.bgg-results-list ul {
    list-style: none;
    margin-top: 10px;
    padding: 0;
}

.bgg-results-list li {
    margin-bottom: 8px;
    padding: 8px;
    background: white;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
    transition: all 0.2s;
}

.bgg-results-list li:hover {
    background: #f0f0f0;
    border-color: #7678ED;
}

.bgg-game-link {
    color: #7678ED;
    text-decoration: none;
    font-weight: 500;
    display: block;
    cursor: pointer;
}

.bgg-game-link:hover {
    color: #5F60D6;
    text-decoration: underline;
}

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

.btn-primary {
    background: #7678ED;
    color: white;
}

.btn-primary:hover {
    background: #5F60D6;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(118, 120, 237, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-search {
    background: #7678ED;
    color: white;
}

.btn-search:hover {
    background: #5F60D6;
}

.btn-played {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9em;
    cursor: pointer;
    transition: background 0.3s;
    display: inline-block;
}

.btn-played:hover {
    background: #45a049;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
    margin-right: 8px;
}

.btn-edit {
    background: #F7B801;
    color: #333;
}

.btn-edit:hover {
    background: #E0A700;
}

.btn-delete {
    background: #F35B04;
    color: white;
}

.btn-delete:hover {
    background: #DC4F03;
}

/* Search Container */
.search-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.search-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
}

.search-input:focus {
    outline: none;
    border-color: #7678ED;
}

.filter-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 0;
}

.filter-range {
    display: flex;
    gap: 8px;
    align-items: center;
}

.filter-range span {
    color: #666;
    font-size: 14px;
}

.filter-input-small {
    flex: 1;
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    min-width: 60px;
}

.filter-input-small:focus {
    outline: none;
    border-color: #7678ED;
}

.filter-select {
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: #7678ED;
}

.search-help {
    margin-top: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    color: rgba(255, 255, 255, 0.9);
}

.search-help small {
    font-size: 12px;
    line-height: 1.5;
}

.search-help strong {
    font-weight: 600;
}

/* Games Container */
.games-container {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.game-card {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 0;
    transition: all 0.3s;
    overflow: hidden;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    border-color: #7678ED;
}

.game-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 20px 20px 15px 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.game-header h3 {
    color: #333;
    font-size: 1.3em;
    margin: 0;
}

.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge.played {
    background: #28a745;
    color: white;
}

.badge.not-played {
    background: #6c757d;
    color: white;
}

.game-details {
    padding: 20px;
}

.game-details p {
    margin-bottom: 10px;
    color: #555;
}

.difficulty {
    padding: 4px 10px;
    border-radius: 5px;
    font-weight: 600;
    font-size: 14px;
}

.difficulty-easy {
    background: #d4edda;
    color: #155724;
}

.difficulty-medium {
    background: #fff3cd;
    color: #856404;
}

.difficulty-hard {
    background: #f8d7da;
    color: #721c24;
}

/* Ratings Section */
.ratings-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.ratings-section h3 {
    font-size: 1.1em;
    margin-bottom: 15px;
    color: #555;
}

.ratings-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.rating-group {
    flex: 1;
    min-width: 150px;
}

.rating-group input[type="number"] {
    width: 100%;
}

.ratings-display {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

.ratings-display p {
    margin-bottom: 8px;
}

.rating-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 13px;
    font-weight: 600;
    margin-right: 8px;
    margin-bottom: 5px;
}

.rating-tage {
    background: #7678ED;
    color: white;
}

.rating-james {
    background: #3D348B;
    color: white;
}

/* Location Section */
.location-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.location-section h3 {
    font-size: 1.1em;
    margin-bottom: 15px;
    color: #555;
}

.location-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.location-group {
    flex: 1;
    min-width: 150px;
}

.location-group input[type="number"] {
    width: 100%;
}

.location-display {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

.location-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    background: #e9ecef;
    color: #495057;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    margin-bottom: 10px;
}

/* Mini Location Grid */
.location-grid-mini {
    width: 100%;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 3px;
    background: white;
    margin-top: 8px;
    box-sizing: border-box;
}

.mini-grid-row {
    display: flex;
    gap: 1px;
    margin-bottom: 1px;
    width: 100%;
}

.mini-grid-row:last-child {
    margin-bottom: 0;
}

.mini-grid-cell {
    flex: 1;
    aspect-ratio: 1;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 1px;
    min-width: 0;
}

.mini-grid-cell.active {
    background: #7678ED;
    border-color: #5F60D6;
    box-shadow: 0 0 2px rgba(118, 120, 237, 0.6);
}

/* Grid Selector */
.grid-selector-container {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.grid-selector-container p {
    margin-bottom: 15px;
    color: #555;
}

.grid-selector {
    width: 100%;
    border: 2px solid #7678ED;
    border-radius: 8px;
    padding: 5px;
    background: white;
    box-sizing: border-box;
}

.grid-row {
    display: flex;
    gap: 2px;
    margin-bottom: 2px;
    width: 100%;
}

.grid-row:last-child {
    margin-bottom: 0;
}

.grid-cell {
    flex: 1;
    aspect-ratio: 1;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
    min-width: 0;
}

.grid-cell:hover {
    background: #E7E8FD;
    border-color: #7678ED;
    transform: scale(1.05);
    z-index: 1;
}

.grid-cell.selected {
    background: #7678ED;
    border-color: #5F60D6;
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(118, 120, 237, 0.4);
}


.game-actions {
    margin-top: 15px;
    padding: 15px 20px 20px 20px;
    border-top: 1px solid #e0e0e0;
}

.no-games {
    text-align: center;
    color: #6c757d;
    font-size: 18px;
    padding: 40px;
}

/* Messages */
.message {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 600;
    animation: slideIn 0.3s ease-out;
}

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

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .search-form {
        flex-direction: column;
    }
    
    .search-input,
    .filter-select {
        width: 100%;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .bgg-search-container {
        flex-direction: column;
    }
    
    .btn-bgg {
        width: 100%;
    }
    
    .ratings-row {
        flex-direction: column;
    }
    
    .rating-group {
        width: 100%;
    }
    
    .location-row {
        flex-direction: column;
    }
    
    .location-group {
        width: 100%;
    }
    
    .grid-selector {
        width: 100%;
    }
    
    .grid-cell {
        min-width: 20px;
    }
}

