/* NCAA Tournament Pool Styles */
/* Colors match truranking.com: #2c3e50 (header), #3498db (accent), #e74c3c (red) */

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

/* Page Layout */
.pool-page {
    background-color: #f4f4f9;
}

.pool-main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Auth Section */
.auth-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.login-prompt p {
    color: #555;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 8px;
    background: white;
}

.auth-btn:hover {
    background: #f5f5f5;
    border-color: #3498db;
}

.auth-icon {
    width: 20px;
    height: 20px;
}

.google-btn {
    border-color: #4285f4;
    color: #333;
}

.google-btn:hover {
    background: #f0f7ff;
}

.email-btn {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
}

.email-btn:hover {
    background: #34495e;
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

#userDisplayName {
    font-weight: 500;
    color: #333;
}

.sign-out-btn {
    padding: 8px 16px;
    background: none;
    border: 1px solid #e74c3c;
    color: #e74c3c;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.sign-out-btn:hover {
    background: #e74c3c;
    color: white;
}

/* Action Buttons */
.pool-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 32px;
    justify-content: center;
}

.action-btn {
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.primary-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.primary-btn:hover {
    background: linear-gradient(135deg, #2980b9, #2471a3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.secondary-btn {
    background: white;
    color: #2c3e50;
    border: 2px solid #2c3e50;
}

.secondary-btn:hover {
    background: #2c3e50;
    color: white;
}

/* Pools Section */
.pools-section {
    margin-top: 24px;
}

.section-title {
    font-size: 1.5rem;
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}

.subsection-title {
    font-size: 1.1rem;
    color: #555;
    margin: 20px 0 12px 0;
}

.pools-list {
    margin-bottom: 24px;
}

.pool-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.pool-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.pool-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border-color: #3498db;
}

.pool-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.pool-card-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.pool-card-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-open {
    background: #d4edda;
    color: #155724;
}

.badge-locked {
    background: #fff3cd;
    color: #856404;
}

.badge-active {
    background: #cce5ff;
    color: #004085;
}

.badge-completed {
    background: #e2e3e5;
    color: #383d41;
}

.pool-card-stats {
    display: flex;
    gap: 20px;
    color: #666;
    font-size: 0.9rem;
}

.pool-card-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pool-card-actions {
    margin-top: 16px;
    display: flex;
    gap: 8px;
}

.pool-card-btn {
    flex: 1;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    text-decoration: none;
}

.btn-view {
    background: #3498db;
    color: white;
    border: none;
}

.btn-view:hover {
    background: #2980b9;
}

.btn-bracket {
    background: white;
    color: #3498db;
    border: 1px solid #3498db;
}

.btn-bracket:hover {
    background: #3498db;
    color: white;
}

.btn-manage {
    background: white;
    color: #8e44ad;
    border: 1px solid #8e44ad;
    text-decoration: none;
    text-align: center;
}

.btn-manage:hover {
    background: #8e44ad;
    color: white;
}

.empty-state {
    color: #888;
    font-style: italic;
    padding: 20px;
    text-align: center;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.create-pool-modal {
    max-width: 700px;
}

/* Settings Modal - wider to accommodate form content */
.settings-modal {
    max-width: 800px;
}

.settings-modal .pool-form {
    padding: 20px 28px;
}

.settings-modal .scoring-grid {
    grid-template-columns: repeat(6, 1fr);
}

.settings-modal textarea {
    min-height: 200px;
}

@media (max-width: 850px) {
    .settings-modal .scoring-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .settings-modal .scoring-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.4rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #666;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #e74c3c;
}

/* Forms */
.pool-form {
    padding: 24px;
}

.form-section {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h4 {
    color: #2c3e50;
    margin: 0 0 16px 0;
    font-size: 1.1rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="datetime-local"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #3498db;
}

.checkbox-group label {
    margin-bottom: 0;
    font-weight: normal;
}

.form-help {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.scoring-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.scoring-grid .form-group {
    margin-bottom: 0;
}

.scoring-grid input {
    text-align: center;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.btn-cancel {
    padding: 12px 24px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    color: #666;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel:hover {
    background: #eee;
}

.btn-submit {
    padding: 12px 24px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-submit:hover:not(:disabled) {
    background: linear-gradient(135deg, #2980b9, #2471a3);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Pool Preview (Join Modal) */
.pool-preview {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.pool-preview h4 {
    margin: 0 0 12px 0;
    color: #2c3e50;
}

.pool-preview-stats {
    display: flex;
    gap: 20px;
    color: #666;
    font-size: 0.9rem;
}

/* Public Pools List */
.public-pools-list {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.public-pool-item {
    padding: 16px;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.public-pool-item:hover {
    border-color: #3498db;
    background: #f8f9fa;
}

.public-pool-info h4 {
    margin: 0 0 4px 0;
    color: #2c3e50;
}

.public-pool-info p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

.public-pool-join {
    padding: 8px 16px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.public-pool-join:hover {
    background: #2980b9;
}

/* Rules Content */
.rules-content {
    padding: 24px;
    font-family: inherit;
    line-height: 1.6;
    color: #333;
}

.rules-content h2 {
    font-size: 1.5rem;
    margin: 0 0 16px 0;
    color: #1a365d;
}

.rules-content h3 {
    font-size: 1.2rem;
    margin: 20px 0 12px 0;
    color: #2d3748;
}

.rules-content h4 {
    font-size: 1rem;
    margin: 16px 0 8px 0;
    color: #4a5568;
}

.rules-content p {
    margin: 0 0 12px 0;
}

.rules-content ul {
    margin: 8px 0 16px 0;
    padding-left: 24px;
}

.rules-content li {
    margin: 4px 0;
}

/* Auth Form */
.auth-form {
    padding: 24px;
}

.auth-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.auth-toggle {
    text-align: center;
    margin-top: 16px;
    color: #666;
}

.link-btn {
    background: none;
    border: none;
    color: #3498db;
    cursor: pointer;
    font-size: inherit;
    text-decoration: underline;
}

.link-btn:hover {
    color: #2980b9;
}

/* Loading States */
.loading-state {
    color: #888;
    text-align: center;
    padding: 40px;
}

/* Responsive */
@media (max-width: 768px) {
    .pool-main-content {
        padding: 16px;
    }

    .pool-actions {
        flex-direction: column;
    }

    .action-btn {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .scoring-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .pool-cards {
        grid-template-columns: 1fr;
    }

    .modal-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }

    .user-info {
        flex-direction: column;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .scoring-grid {
        grid-template-columns: 1fr 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn-cancel,
    .btn-submit {
        width: 100%;
    }

    .auth-btn {
        width: 100%;
        margin: 8px 0;
    }
}

/* Share Pool Modal */
.share-pool-modal {
    max-width: 480px;
}

.share-content {
    padding: 24px;
    text-align: center;
}

.share-instructions {
    color: #555;
    margin-bottom: 24px;
    font-size: 1.05rem;
}

.share-code-section,
.share-link-section {
    margin-bottom: 20px;
    text-align: left;
}

.share-code-section label,
.share-link-section label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.share-code-display,
.share-link-display {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 12px 16px;
}

.join-code-text {
    font-family: 'Courier New', Consolas, monospace;
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
    letter-spacing: 3px;
    flex: 1;
    user-select: all;
}

.share-url-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    color: #3498db;
    outline: none;
    font-family: inherit;
}

.copy-btn {
    padding: 8px 16px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.copy-btn:hover {
    background: #2980b9;
}

.copy-btn.copied {
    background: #27ae60;
}

.share-tip {
    margin-top: 20px;
    font-size: 0.9rem;
    color: #888;
    font-style: italic;
}

.share-pool-modal .modal-footer {
    padding: 16px 24px 24px;
    text-align: center;
}

.share-pool-modal .btn-submit {
    min-width: 120px;
}

/* Settings Modal Styles */
.settings-share-section {
    background: #f0f7ff;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.settings-share-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 16px;
}

.share-code-display.compact,
.share-link-display.compact {
    padding: 8px 12px;
    background: white;
    border: 1px solid #ddd;
}

.share-code-display.compact .join-code-text {
    font-size: 1.2rem;
    letter-spacing: 2px;
}

.share-link-display.compact .share-url-input {
    font-size: 0.85rem;
}

.share-code-display.compact .copy-btn,
.share-link-display.compact .copy-btn {
    padding: 4px 10px;
    font-size: 0.8rem;
}

.form-error {
    background: #fee;
    border: 1px solid #e74c3c;
    color: #c0392b;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
}

@media (max-width: 600px) {
    .settings-share-row {
        grid-template-columns: 1fr;
    }
}
