:root {
    --primary-color: #0891b2;
    --primary-dark: #0e7490;
    --secondary-color: #06b6d4;
    --success-color: #14b8a6;
    --danger-color: #f43f5e;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
}

.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
    animation: fadeIn 0.3s ease-in;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

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

.container {
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

/* Welcome Screen */
#welcome-screen .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
}

.header-icon {
    color: #a5f3fc;
    margin-bottom: 20px;
    animation: rotate 20s linear infinite;
}

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

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 40px;
}

.info-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    width: 100%;
    margin-bottom: 30px;
}

.info-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    box-shadow: var(--shadow-lg);
}

.info-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.info-card h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.info-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    text-align: center;
}

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

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-sm);
}

.btn-start-test {
    margin: 30px auto;
    padding: 20px 40px;
    font-size: 1.2rem;
    font-weight: 700;
    background: white;
    color: var(--primary-color);
    border: none;
    box-shadow: 0 8px 24px rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
}

.btn-start-test:hover {
    background: #f0f9ff;
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(255, 255, 255, 0.4);
}

.btn-start-test .btn-logo {
    width: 28px;
    height: 28px;
}

@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 8px 24px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 8px 32px rgba(255, 255, 255, 0.5);
    }
}

.country-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.country-link:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(10px);
    margin-top: 15px;
}

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

/* Progress Bar */
.progress-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 20px;
    border-radius: 0 0 20px 20px;
    box-shadow: var(--shadow-md);
    margin: -20px -20px 20px -20px;
    backdrop-filter: blur(10px);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(8, 145, 178, 0.2);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Question Card */
.question-card {
    background: white;
    border-radius: 20px;
    padding: 30px 25px;
    box-shadow: var(--shadow-xl);
    margin-bottom: 20px;
}

.question-category {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.category-economic {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.category-social {
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
}

.question-text {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 25px;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-size: 1rem;
}

.option-btn:hover {
    background: #f3f4f6;
    border-color: var(--primary-color);
    transform: translateX(5px);
}

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

.option-emoji {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.option-text {
    font-weight: 500;
    color: var(--text-primary);
}

/* Results Screen */
#results-screen {
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
}

#results-screen h1 {
    text-align: center;
    margin-bottom: 20px;
    color: white;
}

#results-screen .header-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.compass-container {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow-xl);
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#compass-canvas {
    max-width: 100%;
    height: auto;
}

.result-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.result-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    box-shadow: var(--shadow-lg);
}

.result-card h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.result-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.result-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.result-bar {
    width: 100%;
    height: 10px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.result-bar-fill {
    position: absolute;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    transition: all 0.5s ease;
}

.description-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 20px;
}

.description-card h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.description-card p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

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

.action-buttons-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 20px 0;
    position: relative;
    z-index: 10;
    padding: 0 10px;
}

.btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    background: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    min-height: 54px;
    position: relative;
    overflow: hidden;
}

.btn-action::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    z-index: -1;
    transition: opacity 0.3s ease;
}

.btn-action:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-action:hover::before {
    opacity: 0.9;
}

.btn-action:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-action .btn-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.btn-action .btn-text {
    font-size: 0.95rem;
    letter-spacing: 0.3px;
    font-weight: 700;
}

/* Colores específicos para cada botón */
.btn-action:nth-child(1) {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.btn-action:nth-child(1):hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
}

.btn-action:nth-child(2) {
    background: linear-gradient(135deg, #10b981, #059669);
}

.btn-action:nth-child(2):hover {
    background: linear-gradient(135deg, #059669, #047857);
}

.btn-action:nth-child(3) {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.btn-action:nth-child(3):hover {
    background: linear-gradient(135deg, #d97706, #b45309);
}

/* Responsive Design */
@media (min-width: 768px) {
    .info-cards {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .result-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    h1 {
        font-size: 3rem;
    }
    
    .question-text {
        font-size: 1.5rem;
    }
    
    .action-buttons {
        flex-direction: row;
    }
    
    .action-buttons-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
        margin: 25px 0;
        padding: 0 20px;
    }
    
    .btn-action {
        flex-direction: row;
        padding: 16px 24px;
        min-height: 60px;
    }
    
    .btn-action .btn-icon {
        font-size: 1.5rem;
        margin-bottom: 0;
    }
    
    .btn-action .btn-text {
        font-size: 1rem;
        text-align: left;
        line-height: 1.2;
    }
}

/* Touch feedback */
@media (hover: none) {
    .option-btn:hover {
        transform: none;
    }
    
    .option-btn:active {
        background: #e5e7eb;
        border-color: var(--primary-color);
    }
}

/* Loading animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Modal de Compartir */
.share-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
    padding: 20px;
}

.share-modal-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

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

.share-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.share-modal-header h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 0;
}

.share-modal-close {
    background: var(--bg-secondary);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.share-modal-close:hover {
    background: #e5e7eb;
    transform: rotate(90deg);
}

.share-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.share-btn:active {
    transform: translateY(0);
}

.share-icon {
    font-size: 1.5rem;
}

.share-twitter:hover {
    background: #1da1f2;
    color: white;
    border-color: #1da1f2;
}

.share-facebook:hover {
    background: #1877f2;
    color: white;
    border-color: #1877f2;
}

.share-whatsapp:hover {
    background: #25d366;
    color: white;
    border-color: #25d366;
}

.share-telegram:hover {
    background: #0088cc;
    color: white;
    border-color: #0088cc;
}

.share-download:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.share-copy:hover {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

@media (max-width: 480px) {
    .share-buttons {
        grid-template-columns: 1fr;
    }
    
    .share-modal-content {
        padding: 20px;
    }
}

/* Pantalla de Selección de País */
#country-screen .container,
#vote-screen .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
}

#country-screen h1,
#vote-screen h1 {
    color: white;
    margin-bottom: 10px;
}

#country-screen .subtitle,
#vote-screen .subtitle {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 40px;
    font-size: 1.1rem;
}

/* Grid de países con banderas grandes */
.country-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto 30px;
}

.country-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
    text-align: center;
    border: 3px solid transparent;
}

.country-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-xl);
    background: white;
    border-color: var(--primary-color);
}

.country-card:active {
    transform: scale(0.96);
}

.country-flag-large {
    font-size: 5rem;
    margin-bottom: 15px;
    display: block;
    line-height: 1;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    animation: flagFloat 2s ease-in-out infinite;
}

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

.country-flag {
    font-size: 5rem;
    margin-bottom: 15px;
}

.country-card h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 0;
    font-weight: 600;
}

/* Compatibilidad con código antiguo */
.country-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 600px;
    margin-bottom: 30px;
}

/* Pantalla de Candidatos */
.candidates-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    width: 100%;
    max-width: 600px;
    margin-bottom: 30px;
}

.candidate-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    border: 2px solid transparent;
}

.candidate-card:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
    background: white;
}

.candidate-card:active {
    transform: scale(0.98);
}

.candidate-card.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #e0e7ff 0%, #ffffff 100%);
    box-shadow: var(--shadow-xl);
}

.candidate-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-color);
    flex-shrink: 0;
}

.candidate-photo-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
    border: 3px solid var(--border-color);
}

.candidate-info {
    flex: 1;
    text-align: left;
}

.candidate-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 5px 0;
}

.candidate-party {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
}

@media (min-width: 768px) {
    .candidates-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Analytics Screen */
.analytics-summary {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
}

.analytics-summary h3 {
    margin: 0;
    color: #1e293b;
    font-size: 1.3rem;
}

.analytics-empty {
    text-align: center;
    color: #64748b;
    font-size: 1.1rem;
    padding: 40px 20px;
    background: white;
    border-radius: 12px;
    margin: 20px 0;
}

.analytics-canvas-container {
    background: white;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    justify-content: center;
    overflow-x: auto;
    width: 100%;
}

#analytics-compass {
    max-width: 100%;
    width: 100%;
    height: auto;
}

.candidate-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.candidate-stat-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.candidate-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.candidate-stat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
}

.candidate-stat-photo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #007bff;
}

.candidate-photo-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.5rem;
}

.candidate-stat-info h4 {
    margin: 0;
    font-size: 1rem;
    color: #1e293b;
}

.candidate-stat-party {
    margin: 4px 0 0 0;
    font-size: 0.85rem;
    color: #64748b;
}

.candidate-stat-data {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.stat-label {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
}

.stat-value {
    font-size: 0.95rem;
    font-weight: bold;
    color: #1e293b;
    padding: 4px 10px;
    border-radius: 6px;
    background: #f1f5f9;
}

.stat-value.left {
    color: #ef4444;
    background: #fee2e2;
}

.stat-value.right {
    color: #3b82f6;
    background: #dbeafe;
}

.stat-value.libertarian {
    color: #10b981;
    background: #d1fae5;
}

.stat-value.authoritarian {
    color: #f59e0b;
    background: #fef3c7;
}

#analytics-country {
    width: 100%;
    padding: 12px;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 20px;
    background: white;
    color: #1e293b;
    cursor: pointer;
    transition: border-color 0.2s;
}

#analytics-country:focus {
    outline: none;
    border-color: #007bff;
}

@media (max-width: 480px) {
    .country-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .country-card {
        padding: 25px 15px;
    }
    
    .country-flag-large {
        font-size: 3rem;
        margin-bottom: 10px;
    }
    
    .country-card h3 {
        font-size: 0.95rem;
    }
    
    .country-cards {
        grid-template-columns: 1fr;
    }
    
    .candidate-photo,
    .candidate-photo-placeholder {
        width: 60px;
        height: 60px;
    }
    
    .candidate-name {
        font-size: 1rem;
    }
    
    .candidate-party {
        font-size: 0.85rem;
    }
    
    .candidate-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .analytics-canvas-container {
        padding: 10px;
    }
}
