/* Reset y Variables CSS */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --dark-color: #1a1a1a;
    --light-color: #f8f9fa;
    --impostor-color: #c0392b;
    --citizen-color: #2980b9;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --hover-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    --border-radius: 8px;
    --transition: all 0.3s ease;
    --border-color: #e0e0e0;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 20px;
    color: var(--dark-color);
}

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

/* Header */
.header {
    text-align: center;
    color: var(--dark-color);
    margin-bottom: 40px;
    animation: fadeInDown 0.5s ease;
    background: white;
    padding: 40px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
}

.header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    color: var(--primary-color);
    font-weight: 700;
    letter-spacing: -1px;
}

.subtitle {
    font-size: 1.2rem;
    color: #666;
    font-weight: 400;
}

/* Cards */
.card, .instructions-card, .tips-card, .form-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
    animation: fadeInUp 0.5s ease;
    border: 1px solid var(--border-color);
}

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

/* Instructions */
.instructions-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.instruction-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.instruction-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
    border-color: var(--primary-color);
}

.instruction-item .number {
    font-size: 2rem;
    flex-shrink: 0;
}

.instruction-item .text {
    flex: 1;
}

.instruction-item strong {
    color: var(--primary-color);
    display: block;
    margin-bottom: 5px;
    font-size: 1.1rem;
}

/* Tips Card */
.tips-card {
    background: var(--dark-color);
    color: white;
    border: none;
}

.tips-card h3 {
    margin-bottom: 15px;
    font-size: 1.5rem;
    font-weight: 600;
}

.tips-card ul {
    list-style: none;
    padding-left: 0;
}

.tips-card li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tips-card li:last-child {
    border-bottom: none;
}

/* No Mobile Card */
.no-mobile-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: var(--hover-shadow);
    animation: fadeInUp 0.5s ease;
    border: none;
}

.no-mobile-card h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    font-weight: 600;
    text-align: center;
}

.highlight-text {
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 25px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.2);
    padding: 12px 20px;
    border-radius: 8px;
}

.no-mobile-steps {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.step-box {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    background: rgba(255, 255, 255, 0.15);
    padding: 18px;
    border-radius: 10px;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.step-box:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateX(5px);
}

.step-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
    line-height: 1;
}

.step-content {
    flex: 1;
}

.step-content h4 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.step-content p {
    font-size: 1rem;
    line-height: 1.6;
    opacity: 0.95;
}

.important-note {
    background: rgba(255, 255, 255, 0.95);
    color: #c0392b;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-size: 1rem;
    border-left: 4px solid #c0392b;
}

.important-note strong {
    display: block;
    margin-bottom: 5px;
    font-size: 1.1rem;
}

/* Wake Lock Controls */
.wake-lock-controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 20px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.btn-wake-lock {
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-wake-on {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-wake-on:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-wake-off {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
}

.btn-wake-off:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.wake-lock-status {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    padding: 5px 10px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.8);
}

@media (max-width: 768px) {
    .wake-lock-controls {
        bottom: 10px;
        padding: 10px 15px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .btn-wake-lock {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    
    .wake-lock-status {
        font-size: 0.8rem;
        width: 100%;
        text-align: center;
        margin-top: 5px;
    }
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-success, .btn-warning, .btn-danger {
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
}

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

.btn-primary:hover {
    background: #5f4fd1;
    transform: scale(1.05);
}

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

.btn-secondary:hover {
    background: #958ae5;
    transform: scale(1.05);
}

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

.btn-success:hover {
    background: #00a07e;
}

.btn-warning {
    background: var(--warning-color);
    color: var(--dark-color);
}

.btn-warning:hover {
    background: #fcbf49;
}

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

.btn-danger:hover {
    background: #ff6b6b;
}

.btn-large {
    width: 100%;
    padding: 20px;
    font-size: 1.3rem;
}

.btn-small {
    padding: 8px 15px;
    font-size: 0.9rem;
}

.button-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 30px 0;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--dark-color);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.help-text {
    display: block;
    margin-top: 5px;
    font-size: 0.85rem;
    color: #6c757d;
}

/* Info Box */
.info-box {
    background: #e3f2fd;
    border-left: 4px solid var(--citizen-color);
    padding: 20px;
    margin: 20px 0;
    border-radius: 8px;
}

.info-box h3 {
    color: var(--citizen-color);
    margin-bottom: 10px;
}

.info-box ul {
    list-style: none;
    padding-left: 0;
}

.info-box li {
    padding: 5px 0;
    padding-left: 20px;
    position: relative;
}

.info-box li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: var(--border-radius);
    max-width: 500px;
    position: relative;
    animation: slideDown 0.3s ease;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 2rem;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close:hover {
    color: var(--danger-color);
}

/* Admin Panel */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.game-code {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 1.2rem;
}

/* QR Card */
.qr-card {
    text-align: center;
}

#qrcode {
    display: inline-block;
    padding: 20px;
    background: white;
    border-radius: 10px;
    margin: 20px 0;
}

.qr-url {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.qr-url input {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
}

.btn-copy {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

/* Settings Card */
.setting-item {
    display: flex;
    justify-content: space-between;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

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

.setting-label {
    font-weight: bold;
}

.setting-value {
    color: var(--primary-color);
}

/* Status Badge */
.status-badge {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
}

.status-waiting {
    background: var(--warning-color);
    color: var(--dark-color);
}

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

.status-voting {
    background: var(--citizen-color);
    color: white;
}

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

/* Players List */
.players-list {
    max-height: 400px;
    overflow-y: auto;
}

.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--light-color);
    margin-bottom: 10px;
    border-radius: 10px;
    transition: var(--transition);
}

.player-item:hover {
    background: #e9ecef;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-badge {
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: bold;
}

.badge-admin {
    background: var(--primary-color);
    color: white;
}

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

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

/* Game Timer */
.game-timer {
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 10px;
    margin-top: 15px;
}

.timer-label {
    display: block;
    font-size: 1rem;
    margin-bottom: 5px;
}

.timer-value {
    display: block;
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* Game Screen */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

.player-name {
    font-size: 1.2rem;
    font-weight: bold;
}

/* Role Card */
.role-card-container {
    perspective: 1000px;
    margin: 30px auto;
    max-width: 400px;
}

.role-card {
    width: 100%;
    height: 300px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    cursor: pointer;
}

.role-card.flipped {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    box-shadow: var(--card-shadow);
}

.card-front {
    background: var(--dark-color);
    color: white;
}

.card-back {
    background: white;
    transform: rotateY(180deg);
}

.card-content {
    text-align: center;
}

.flip-indicator {
    margin-top: 20px;
    font-size: 0.9rem;
    opacity: 0.7;
    animation: bounce 2s infinite;
}

.role-display {
    font-size: 2.5rem;
    font-weight: bold;
    margin: 20px 0;
}

.role-impostor {
    color: var(--impostor-color);
}

.role-citizen {
    color: var(--citizen-color);
}

/* Voting */
.voting-players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.voting-player-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.voting-player-card:hover {
    border-color: var(--primary-color);
    transform: scale(1.03);
    box-shadow: var(--hover-shadow);
}

.voting-player-card.selected {
    border-color: var(--danger-color);
    border-width: 3px;
    background: #fff5f5;
}

.voting-player-card.dead {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Footer */
.footer {
    text-align: center;
    color: #666;
    margin-top: 40px;
    padding: 20px;
}

.version {
    font-size: 0.9rem;
    margin-top: 10px;
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.alert-error {
    background: #ffe5e5;
    border-left: 4px solid var(--danger-color);
    color: var(--danger-color);
}

.alert-success {
    background: #e8f8f5;
    border-left: 4px solid var(--success-color);
    color: var(--success-color);
}

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

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

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

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

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

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .header {
        padding: 25px 15px;
        margin-bottom: 20px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .card, .instructions-card, .tips-card, .form-card, .no-mobile-card {
        padding: 20px 15px;
        margin-bottom: 15px;
    }

    .instruction-item, .step-box {
        padding: 12px;
        gap: 12px;
    }

    .instruction-item .number, .step-icon {
        font-size: 1.8rem;
    }

    .instruction-item strong, .step-content h4 {
        font-size: 1rem;
    }

    .instruction-item p, .step-content p {
        font-size: 0.95rem;
    }

    .no-mobile-card h3 {
        font-size: 1.5rem;
    }

    .highlight-text {
        font-size: 1rem;
        padding: 10px 15px;
    }

    .important-note {
        padding: 12px;
        font-size: 0.95rem;
    }

    .tips-card h3 {
        font-size: 1.3rem;
    }

    .tips-card li {
        font-size: 0.95rem;
        padding: 8px 0;
    }
    
    .admin-grid {
        grid-template-columns: 1fr;
    }
    
    .button-container {
        flex-direction: column;
    }

    .btn-primary, .btn-secondary {
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    .game-header {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .no-mobile-card h3 {
        font-size: 1.3rem;
    }

    .step-icon {
        font-size: 2rem;
    }

    .step-content h4 {
        font-size: 0.95rem;
    }

    .step-content p {
        font-size: 0.9rem;
    }
}

/* Back Link */
.back-link {
    display: inline-block;
    color: white;
    text-decoration: none;
    margin-top: 10px;
    opacity: 0.9;
    transition: var(--transition);
}

.back-link:hover {
    opacity: 1;
    transform: translateX(-5px);
}

/* Divider */
.divider {
    text-align: center;
    margin: 30px 0;
    position: relative;
    color: #999;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 45%;
    height: 1px;
    background: #ddd;
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

/* Game Status */
.game-status {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--card-shadow);
}

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

/* Waiting Area */
.waiting-area {
    text-align: center;
}

.waiting-animation {
    font-size: 5rem;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.waiting-players-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.waiting-player {
    background: var(--light-color);
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
}

/* Game Timer Display */
.game-timer-display {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    text-align: center;
    margin: 20px 0;
    box-shadow: var(--card-shadow);
}

/* Instruction Box */
.instruction-box {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
}

.impostor-style {
    background: linear-gradient(135deg, #d63031, #ff7675);
    color: white;
}

/* Control Buttons */
.control-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Botón de acceso rápido a admin desde game.php */
.btn-admin-access {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.9rem;
    transition: var(--transition);
    margin-right: 10px;
    box-shadow: 0 3px 10px rgba(243, 156, 18, 0.3);
}

.btn-admin-access:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.5);
    background: linear-gradient(135deg, #e67e22, #d35400);
}

/* Modales Personalizados */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    padding: 0;
    animation: scaleIn 0.3s ease;
    overflow: hidden;
}

.modal-header {
    padding: 25px 30px;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-align: center;
}

.modal-header.success {
    background: linear-gradient(135deg, var(--success-color), #55efc4);
}

.modal-header.error {
    background: linear-gradient(135deg, var(--danger-color), #ff6b6b);
}

.modal-header.info {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.modal-header.warning {
    background: linear-gradient(135deg, var(--warning-color), #ffeaa7);
    color: var(--dark-color);
}

.modal-body {
    padding: 30px;
    font-size: 1.1rem;
    color: var(--dark-color);
    text-align: center;
    line-height: 1.6;
}

.modal-footer {
    padding: 20px 30px;
    display: flex;
    justify-content: center;
    gap: 10px;
    background-color: var(--light-color);
}

.modal-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    min-width: 100px;
}

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

.modal-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 92, 231, 0.4);
}

.modal-btn-secondary {
    background: #dfe6e9;
    color: var(--dark-color);
}

.modal-btn-secondary:hover {
    background: #b2bec3;
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}
