/**
 * Styles - Piquette Party
 * Plateforme centralisee
 */

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

:root {
    --bg-dark: #1a1a2e;
    --bg-card: rgba(255, 255, 255, 0.05);
    --primary: #667eea;
    --primary-hover: #5a6fd6;
    --secondary: #764ba2;
    --success: #4CAF50;
    --danger: #f44336;
    --warning: #ff9800;
    --text: #ffffff;
    --text-muted: #a0a0a0;
    --trix-color: #4ecdc4;
    --tetris-color: #a855f7;

}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #16213e 100%);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

/* Header */
.platform-header {
    text-align: center;
    margin-bottom: 30px;
    margin-top: 20px;
}

.platform-title {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.platform-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Container */
.platform-container {
    width: 100%;
    max-width: 500px;
}

/* Ecrans */
.screen {
    display: none;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

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

/* Boutons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: white;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
}

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

.btn-danger:hover:not(:disabled) {
    background: #d32f2f;
}

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

.btn-success:hover:not(:disabled) {
    background: #388E3C;
}

/* Formulaires */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text);
    font-size: 1.1rem;
    text-align: center;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.error-message {
    color: var(--danger);
    font-size: 0.9rem;
    margin-top: 10px;
    text-align: center;
    min-height: 1.2em;
}

/* ===== ECRAN LOGIN ===== */
#loginScreen {
    text-align: center;
}

#loginScreen h2 {
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.existing-users {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 25px;
    max-height: 300px;
    overflow-y: auto;
}

.user-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.user-card .user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.user-card .user-name {
    font-size: 1.05rem;
    font-weight: 500;
}

.no-users {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 15px;
}

.separator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.separator::before,
.separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.create-account {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
}

.create-account .form-group input {
    text-transform: none;
    letter-spacing: normal;
}

/* ===== ECRAN DASHBOARD ===== */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.dashboard-header h2 {
    font-size: 1.4rem;
}

/* Stats */
.stats-section {
    margin-bottom: 25px;
}

.stats-section h3,
.invitations-section h3,
.create-game-section h3,
.active-games-section h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 14px 10px;
    text-align: center;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-value.win {
    background: var(--success);
    -webkit-background-clip: text;
    background-clip: text;
}

.stat-value.lose {
    background: var(--danger);
    -webkit-background-clip: text;
    background-clip: text;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.stats-by-game {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.game-stat-block {
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-card);
}

.game-stat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 0.9rem;
}

.expandable .game-stat-row {
    cursor: pointer;
    user-select: none;
}
.expandable .game-stat-row:hover {
    background: rgba(255, 255, 255, 0.06);
}

.game-stat-row .game-name {
    font-weight: 600;
    min-width: 90px;
}

.game-stat-row .game-name.trix { color: var(--trix-color); }

.game-stat-row .game-detail {
    color: var(--text-muted);
    flex: 1;
}

.stat-toggle {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.2s;
}
.game-stat-block.open .stat-toggle {
    transform: rotate(180deg);
}

.game-history-list {
    display: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 4px 0;
}
.game-stat-block.open .game-history-list {
    display: block;
}

.game-history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 14px;
    font-size: 0.85rem;
}
.game-history-item:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.hist-opponent {
    flex: 1;
    color: var(--text-muted);
}
.hist-score {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}
.hist-result {
    min-width: 56px;
    text-align: right;
    font-size: 0.8rem;
    font-weight: 600;
}
.hist-result.win   { color: var(--success); }
.hist-result.loss  { color: var(--danger); }
.hist-result.draw  { color: var(--text-muted); }
.hist-date {
    color: var(--text-muted);
    font-size: 0.8rem;
    min-width: 36px;
    text-align: right;
}

/* Invitations */
.invitations-section {
    margin-bottom: 25px;
}

.invitations-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.invitation-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.invitation-info {
    flex: 1;
}

.invitation-from {
    font-weight: 600;
    font-size: 0.95rem;
}

.invitation-game {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.invitation-actions {
    display: flex;
    gap: 6px;
}

.invitation-actions .btn {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.no-invitations {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    padding: 10px;
}

/* Parties actives */
.active-games-section {
    margin-bottom: 25px;
}

.active-games-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.active-game-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.active-game-card:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

.active-game-info .active-game-type {
    font-weight: 600;
    font-size: 0.95rem;
}

.active-game-info .active-game-type.trix { color: var(--trix-color); }

.active-game-info .active-game-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.active-game-arrow {
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* Creer une partie */
.create-game-section {
    margin-bottom: 10px;
}

.game-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-game {
    flex: 1 1 calc(33% - 10px);
    min-width: 80px;
    padding: 16px 10px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    transition: all 0.2s;
}

.btn-trix {
    background: linear-gradient(135deg, var(--trix-color), #2ecc71);
    color: white;
}

.btn-trix:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(78, 205, 196, 0.4);
}

.btn-tetris {
    background: linear-gradient(135deg, var(--tetris-color), #7c3aed);
    color: white;
}

.btn-tetris:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(168, 85, 247, 0.4);
}

.game-stat-row .game-name.tetris { color: var(--tetris-color); }
.active-game-info .active-game-type.tetris { color: var(--tetris-color); }

.btn-bubbles {
    background: linear-gradient(135deg, #44aaff, #1e40af);
    color: white;
}

.btn-bubbles:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(68, 170, 255, 0.4);
}

.game-stat-row .game-name.bubbles { color: #44aaff; }
.active-game-info .active-game-type.bubbles { color: #44aaff; }

.btn-cassebrik {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.btn-cassebrik:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(231, 76, 60, 0.4);
}

.game-stat-row .game-name.cassebrik { color: #e74c3c; }
.active-game-info .active-game-type.cassebrik { color: #e74c3c; }

.btn-dumpster {
    background: linear-gradient(135deg, #27ae60, #1e8449);
    color: white;
}

.btn-dumpster:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(39, 174, 96, 0.4);
}

.game-stat-row .game-name.dumpster { color: #27ae60; }
.active-game-info .active-game-type.dumpster { color: #27ae60; }


/* ===== ECRAN PARTIE CREEE ===== */
#gameCreatedScreen {
    text-align: center;
}

#gameCreatedScreen h2 {
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.game-code-display {
    text-align: center;
    margin-bottom: 20px;
}

.game-code-display .label {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.game-code-display .code {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 8px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.invite-options {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: left;
}

.invite-options h3 {
    font-size: 1rem;
    margin-bottom: 12px;
}

.invite-link-container {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 20px;
}

.invite-link {
    flex: 1;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.invite-options h4 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.invite-user-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.invite-user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
}

.invite-user-row .user-name {
    font-size: 0.95rem;
}

.invite-user-row .btn {
    padding: 4px 12px;
    font-size: 0.8rem;
}

.invite-user-row .btn.invited {
    background: var(--success);
    cursor: default;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}
