/* PoemGame HTMX Frontend Styles */

:root {
    --pg-primary: #6366f1;
    --pg-primary-dark: #4f46e5;
    --pg-secondary: #8b5cf6;
    --pg-secondary-dark: #7c3aed;
    --pg-tertiary: #06b6d4;
    --pg-tertiary-dark: #0891b2;
    --pg-success: #10b981;
    --pg-warning: #f59e0b;
    --pg-error: #ef4444;
    --pg-gray-50: #f9fafb;
    --pg-gray-100: #f3f4f6;
    --pg-gray-200: #e5e7eb;
    --pg-gray-300: #d1d5db;
    --pg-gray-400: #9ca3af;
    --pg-gray-500: #6b7280;
    --pg-gray-600: #4b5563;
    --pg-gray-700: #374151;
    --pg-gray-800: #1f2937;
    --pg-gray-900: #111827;
    --pg-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --pg-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --pg-border-radius: 0.5rem;
    --pg-transition: all 0.2s ease-in-out;
}

/* Base styles */
.poemgame-app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--pg-gray-800);
}

.pg-header {
    text-align: center;
    margin-bottom: 3rem;
}

.pg-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--pg-gray-900);
    margin-bottom: 0.5rem;
}

.pg-header p {
    font-size: 1.125rem;
    color: var(--pg-gray-600);
}

/* Game mode cards */
.pg-game-modes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.pg-mode-card {
    background: white;
    border: 1px solid var(--pg-gray-200);
    border-radius: var(--pg-border-radius);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--pg-shadow);
    transition: var(--pg-transition);
}

.pg-mode-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--pg-shadow-lg);
}

.pg-mode-card h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--pg-gray-900);
    margin-bottom: 1rem;
}

.pg-mode-card p {
    color: var(--pg-gray-600);
    margin-bottom: 1.5rem;
}

/* Buttons */
.pg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--pg-border-radius);
    cursor: pointer;
    transition: var(--pg-transition);
    text-decoration: none;
    min-width: 140px;
}

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

.pg-btn-primary:hover {
    background: var(--pg-primary-dark);
    transform: translateY(-1px);
}

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

.pg-btn-secondary:hover {
    background: var(--pg-secondary-dark);
    transform: translateY(-1px);
}

.pg-btn-tertiary {
    background: var(--pg-tertiary);
    color: white;
}

.pg-btn-tertiary:hover {
    background: var(--pg-tertiary-dark);
    transform: translateY(-1px);
}

.pg-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Theme selector */
#pg-theme-selector {
    margin-bottom: 3rem;
}

.pg-theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.pg-theme-item {
    background: white;
    border: 1px solid var(--pg-gray-200);
    border-radius: var(--pg-border-radius);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--pg-transition);
}

.pg-theme-item:hover {
    border-color: var(--pg-primary);
    transform: translateY(-1px);
}

.pg-theme-item.selected {
    border-color: var(--pg-primary);
    background: var(--pg-primary);
    color: white;
}

.pg-theme-item h4 {
    margin: 0 0 0.5rem 0;
    font-weight: 600;
}

.pg-theme-item p {
    margin: 0;
    font-size: 0.875rem;
    opacity: 0.8;
}

/* Shared games section */
.pg-shared-games {
    background: white;
    border: 1px solid var(--pg-gray-200);
    border-radius: var(--pg-border-radius);
    padding: 2rem;
    box-shadow: var(--pg-shadow);
}

.pg-shared-games h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--pg-gray-900);
}

.pg-shared-tabs {
    display: flex;
    border-bottom: 1px solid var(--pg-gray-200);
    margin-bottom: 1.5rem;
}

.pg-tab {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--pg-gray-600);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--pg-transition);
}

.pg-tab:hover {
    color: var(--pg-gray-900);
}

.pg-tab.active {
    color: var(--pg-primary);
    border-bottom-color: var(--pg-primary);
}

/* Game lists */
.pg-theme-games,
.pg-public-games,
.pg-member-games {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pg-game-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--pg-gray-100);
    transition: var(--pg-transition);
}

.pg-game-item:hover {
    background: var(--pg-gray-50);
}

.pg-game-item:last-child {
    border-bottom: none;
}

.pg-game-item a {
    color: var(--pg-primary);
    text-decoration: none;
    font-weight: 500;
}

.pg-game-item a:hover {
    text-decoration: underline;
}

.pg-turn-info,
.pg-theme {
    color: var(--pg-gray-600);
    font-size: 0.875rem;
}

/* Empty states */
.pg-empty {
    text-align: center;
    padding: 3rem;
    color: var(--pg-gray-500);
    font-style: italic;
}

/* Game fragment (for live updates) */
.pg-game-fragment {
    background: white;
    border: 1px solid var(--pg-gray-200);
    border-radius: var(--pg-border-radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.pg-game-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--pg-gray-100);
}

.pg-phase {
    font-weight: 600;
    color: var(--pg-primary);
}

.pg-turn {
    color: var(--pg-gray-600);
    font-size: 0.875rem;
}

.pg-turns {
    margin-bottom: 1.5rem;
}

.pg-turn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--pg-gray-50);
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
}

.pg-player {
    font-weight: 600;
    color: var(--pg-primary);
    min-width: 100px;
}

.pg-content {
    flex: 1;
    font-style: italic;
}

.pg-turn-number {
    color: var(--pg-gray-500);
    font-size: 0.75rem;
    font-weight: 600;
}

/* Turn form */
.pg-turn-form {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.pg-turn-form input[type="text"] {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--pg-gray-300);
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: var(--pg-transition);
}

.pg-turn-form input[type="text"]:focus {
    outline: none;
    border-color: var(--pg-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.pg-turn-form button {
    padding: 0.75rem 1.5rem;
    background: var(--pg-success);
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--pg-transition);
}

.pg-turn-form button:hover {
    background: #059669;
    transform: translateY(-1px);
}

/* Queue status */
.pg-queue-status {
    background: var(--pg-warning);
    color: white;
    padding: 1rem;
    border-radius: var(--pg-border-radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pg-queue-status button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: var(--pg-transition);
}

.pg-queue-status button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Responsive design */
@media (max-width: 768px) {
    .poemgame-app {
        padding: 1rem;
    }
    
    .pg-header h1 {
        font-size: 2rem;
    }
    
    .pg-game-modes {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .pg-mode-card {
        padding: 1.5rem;
    }
    
    .pg-theme-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .pg-turn {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .pg-turn-form {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Loading states */
.pg-loading {
    opacity: 0.6;
    pointer-events: none;
}

.pg-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--pg-gray-300);
    border-top-color: var(--pg-primary);
    border-radius: 50%;
    animation: pg-spin 1s linear infinite;
}

@keyframes pg-spin {
    to {
        transform: rotate(360deg);
    }
}

/* HTMX-specific styles */
.htmx-request {
    opacity: 0.6;
    pointer-events: none;
}

.htmx-indicator {
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.htmx-request .htmx-indicator {
    opacity: 1;
}

/* Error states */
.pg-error {
    background: var(--pg-error);
    color: white;
    padding: 1rem;
    border-radius: var(--pg-border-radius);
    margin-bottom: 1rem;
}

.pg-success {
    background: var(--pg-success);
    color: white;
    padding: 1rem;
    border-radius: var(--pg-border-radius);
    margin-bottom: 1rem;
}

/* Game completion */
.pg-game-completed {
    background: var(--pg-success);
    color: white;
    padding: 2rem;
    border-radius: var(--pg-border-radius);
    text-align: center;
    margin-bottom: 1rem;
}

.pg-game-completed h3 {
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
}

.pg-final-haiku {
    background: rgba(255, 255, 255, 0.2);
    padding: 1.5rem;
    border-radius: 0.375rem;
    margin: 1rem 0;
    font-style: italic;
    line-height: 1.8;
}

