/* ========================================
   Quien es mas probable - Styles
   Mobile-first design (320px base)
   ======================================== */

/* CSS Variables */
:root {
    --color-primary: #E91E63;
    --color-primary-dark: #C2185B;
    --color-secondary: #9C27B0;
    --color-secondary-dark: #7B1FA2;
    --color-background: #1a1a2e;
    --color-surface: #16213e;
    --color-surface-light: #1f3460;
    --color-text: #ffffff;
    --color-text-muted: #a0a0a0;
    --color-success: #4CAF50;
    --color-error: #f44336;
    --color-gold: #FFD700;

    --transition-speed: 0.3s;
    --border-radius: 12px;
    --border-radius-sm: 8px;

    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--color-background);
    color: var(--color-text);
    min-height: 100vh;
    min-height: 100dvh;
    line-height: 1.5;
    overflow-x: hidden;
}

/* Screen Management */
.screen {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    padding: var(--spacing-md);
    animation: fadeIn 0.3s ease-out;
}

.screen.active {
    display: flex;
}

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

/* Header */
.header {
    text-align: center;
    padding: var(--spacing-lg) 0;
}

.header-small {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) 0;
    text-align: left;
}

.title {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--spacing-xs);
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.98);
}

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

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

.btn-primary:hover:not(:disabled) {
    filter: brightness(1.1);
}

.btn-secondary {
    background: var(--color-surface-light);
    color: var(--color-text);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-surface);
}

.btn-large {
    width: 100%;
    min-height: 56px;
    font-size: 1.1rem;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    border-radius: 50%;
    transition: background var(--transition-speed);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-icon:hover {
    background: var(--color-surface-light);
}

/* Setup Screen */
.setup-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Players List */
.players-section {
    flex: 1;
}

.players-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    max-height: 200px;
    overflow-y: auto;
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-surface);
    border-radius: var(--border-radius-sm);
    animation: slideIn 0.2s ease-out;
}

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

.player-name {
    font-weight: 500;
}

.btn-remove {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: 50%;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
    touch-action: manipulation;
}

.btn-remove:hover {
    background: var(--color-error);
    color: var(--color-text);
}

/* Add Player Form */
.add-player-form {
    display: flex;
    gap: var(--spacing-sm);
}

.player-input {
    flex: 1;
    min-height: 48px;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-surface);
    border: 2px solid transparent;
    border-radius: var(--border-radius-sm);
    color: var(--color-text);
    font-size: 1rem;
    outline: none;
    transition: border-color var(--transition-speed);
}

.player-input:focus {
    border-color: var(--color-primary);
}

.player-input::placeholder {
    color: var(--color-text-muted);
}

.error-message {
    color: var(--color-error);
    font-size: 0.875rem;
    min-height: 1.5em;
    margin-top: var(--spacing-xs);
}

/* Category Select */
.category-section {
    margin-bottom: var(--spacing-md);
}

.category-select {
    width: 100%;
    min-height: 48px;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-surface);
    border: 2px solid transparent;
    border-radius: var(--border-radius-sm);
    color: var(--color-text);
    font-size: 1rem;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23a0a0a0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 44px;
}

.category-select:focus {
    border-color: var(--color-primary);
}

.category-select option {
    background: var(--color-surface);
    color: var(--color-text);
}

.hint {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    margin-top: var(--spacing-sm);
}

/* Question Screen */
.category-badge {
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--color-surface-light);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    color: var(--color-primary);
}

.question-counter {
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.question-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--spacing-xl);
}

.question-card {
    background: var(--color-surface);
    border-radius: var(--border-radius);
    padding: var(--spacing-xl);
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.question-prefix {
    font-size: 1rem;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-md);
}

.question-text {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--color-text);
}

.question-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

/* Voting Screen */
.voting-title {
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    width: 100%;
}

.voting-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.voting-players {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    overflow-y: auto;
    max-height: 50vh;
}

.vote-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 56px;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--color-surface);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    color: var(--color-text);
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-speed);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.vote-btn:hover {
    background: var(--color-surface-light);
    border-color: var(--color-primary);
}

.vote-btn:active {
    transform: scale(0.98);
}

.vote-btn.voted {
    background: var(--color-primary);
    border-color: var(--color-primary);
    animation: pulse 0.3s ease-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.vote-count-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    min-width: 24px;
    text-align: center;
}

.voting-status {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 1rem;
}

/* Result Screen */
.result-title {
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    width: 100%;
}

.result-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--spacing-xl);
}

.winner-section {
    text-align: center;
    animation: bounceIn 0.5s ease-out;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.winner-emoji {
    font-size: 4rem;
    display: block;
    margin-bottom: var(--spacing-md);
}

.winner-name {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-gold);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.winner-votes {
    color: var(--color-text-muted);
    font-size: 1rem;
    margin-top: var(--spacing-xs);
}

.votes-breakdown {
    background: var(--color-surface);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
}

.vote-bar-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) 0;
}

.vote-bar-item:not(:last-child) {
    border-bottom: 1px solid var(--color-surface-light);
}

.vote-bar-name {
    min-width: 80px;
    font-weight: 500;
    text-align: right;
}

.vote-bar-container {
    flex: 1;
    height: 24px;
    background: var(--color-surface-light);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.vote-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    border-radius: var(--border-radius-sm);
    transition: width 0.5s ease-out;
}

.vote-bar-count {
    min-width: 30px;
    font-weight: 600;
    color: var(--color-text-muted);
}

/* Responsive - Tablet and up */
@media (min-width: 768px) {
    .screen {
        max-width: 500px;
        margin: 0 auto;
        padding: var(--spacing-xl);
    }

    .title {
        font-size: 2.25rem;
    }

    .question-text {
        font-size: 1.75rem;
    }

    .question-actions {
        flex-direction: row;
    }

    .question-actions .btn {
        flex: 1;
    }
}
