/**
 * Quiz Selezione Razza CSS
 * Mobile-first responsive design
 *
 * @package Caniincasa
 */

/* ========================================
   Variables
======================================== */
:root {
    --quiz-primary: #f97316;
    --quiz-primary-dark: #ea580c;
    --quiz-secondary: #64748b;
    --quiz-success: #10b981;
    --quiz-error: #ef4444;
    --quiz-bg-light: #f8fafc;
    --quiz-border: #e2e8f0;
    --quiz-text: #1e293b;
    --quiz-text-light: #64748b;
    --quiz-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --quiz-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --quiz-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --quiz-radius: 12px;
    --quiz-transition: all 0.3s ease;
}

/* ========================================
   Hero Section
======================================== */
.quiz-hero {
    background: linear-gradient(135deg, var(--quiz-primary) 0%, var(--quiz-primary-dark) 100%);
    padding: 60px 20px 40px;
    text-align: center;
    color: white;
}

.quiz-hero-title {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 12px;
    line-height: 1.2;
}

.quiz-hero-subtitle {
    font-size: 16px;
    opacity: 0.95;
    margin: 0;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.5;
}

/* ========================================
   Quiz Section
======================================== */
.quiz-section {
    padding: 40px 20px 80px;
    background: var(--quiz-bg-light);
    min-height: calc(100vh - 200px);
}

.quiz-container {
    max-width: 800px;
    margin: -40px auto 0;
    background: white;
    border-radius: var(--quiz-radius);
    box-shadow: var(--quiz-shadow-lg);
    padding: 40px 24px;
}

/* ========================================
   Progress Bar
======================================== */
.quiz-progress-wrapper {
    margin-bottom: 40px;
}

.quiz-progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--quiz-text-light);
    font-weight: 600;
}

.quiz-progress-bar {
    height: 8px;
    background: var(--quiz-border);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
}

.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--quiz-primary) 0%, var(--quiz-primary-dark) 100%);
    border-radius: 20px;
    transition: width 0.4s ease;
    width: 11.11%; /* 1/9 questions */
}

/* ========================================
   Quiz Questions
======================================== */
.quiz-question {
    display: none;
    animation: fadeInUp 0.4s ease;
}

.quiz-question.active {
    display: block;
}

.question-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--quiz-text);
    margin: 0 0 32px;
    line-height: 1.3;
}

.quiz-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

/* ========================================
   Quiz Option Cards
======================================== */
.quiz-option-card {
    position: relative;
    cursor: pointer;
    display: block;
}

.quiz-option-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.option-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding: 24px 20px;
    border: 2px solid var(--quiz-border);
    border-radius: 12px;
    transition: var(--quiz-transition);
    background: white;
    position: relative;
}

.quiz-option-card:hover .option-content {
    border-color: var(--quiz-primary);
    box-shadow: var(--quiz-shadow-md);
    transform: translateY(-2px);
}

.quiz-option-card input:checked + .option-content {
    border-color: var(--quiz-primary);
    background: rgba(249, 115, 22, 0.03);
}

.option-icon {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--quiz-bg-light);
    border-radius: 16px;
    font-size: 36px;
    transition: var(--quiz-transition);
}

.quiz-option-card input:checked + .option-content .option-icon {
    background: var(--quiz-primary);
    transform: scale(1.1);
}

.option-content h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--quiz-text);
    margin: 0 0 6px;
}

.option-content p {
    font-size: 14px;
    color: var(--quiz-text-light);
    margin: 0;
    line-height: 1.5;
}

.option-checkmark {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--quiz-success);
    color: white;
    display: none;
    align-items: center;
    justify-content: center;
}

.quiz-option-card input:checked + .option-content .option-checkmark {
    display: flex;
    animation: scaleIn 0.3s ease;
}

/* ========================================
   Navigation Buttons
======================================== */
.quiz-navigation {
    display: flex;
    gap: 16px;
    margin-top: 40px;
}

.quiz-navigation .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: var(--quiz-transition);
    text-decoration: none;
    line-height: 1.5;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--quiz-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--quiz-shadow-md);
}

.btn-outline {
    background: white;
    color: var(--quiz-text);
    border: 2px solid var(--quiz-border);
    flex: 0 0 auto;
    min-width: 140px;
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--quiz-primary);
    color: var(--quiz-primary);
}

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

.btn-loading {
    display: none;
}

.btn.loading .btn-text {
    display: none;
}

.btn.loading .btn-loading {
    display: flex;
}

.spinner {
    animation: spin 1s linear infinite;
}

/* ========================================
   Results Section
======================================== */
.quiz-results {
    display: none;
    animation: fadeInUp 0.5s ease;
}

.quiz-results.active {
    display: block;
}

.results-header {
    text-align: center;
    margin-bottom: 40px;
}

.results-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--quiz-text);
    margin: 0 0 12px;
}

.results-subtitle {
    font-size: 16px;
    color: var(--quiz-text-light);
    margin: 0;
    line-height: 1.6;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

/* ========================================
   Breed Result Card
======================================== */
.breed-card {
    display: flex;
    gap: 20px;
    padding: 24px;
    background: white;
    border: 2px solid var(--quiz-border);
    border-radius: 12px;
    transition: var(--quiz-transition);
    position: relative;
    overflow: hidden;
}

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

.breed-card.top-match {
    border-color: var(--quiz-success);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(16, 185, 129, 0.02) 100%);
}

.breed-card.top-match::before {
    content: '🏆 Migliore Corrispondenza';
    position: absolute;
    top: 0;
    right: 0;
    background: var(--quiz-success);
    color: white;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 600;
    border-bottom-left-radius: 8px;
}

.breed-rank {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--quiz-bg-light);
    border-radius: 12px;
    font-size: 24px;
    font-weight: 700;
    color: var(--quiz-primary);
}

.breed-card.top-match .breed-rank {
    background: var(--quiz-success);
    color: white;
}

.breed-image-container {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--quiz-bg-light);
}

.breed-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.breed-info {
    flex: 1;
}

.breed-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--quiz-text);
    margin: 0 0 8px;
}

.breed-description {
    font-size: 14px;
    color: var(--quiz-text-light);
    margin: 0 0 12px;
    line-height: 1.5;
}

.breed-match {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--quiz-primary);
    color: white;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.breed-card.top-match .breed-match {
    background: var(--quiz-success);
}

.breed-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    color: var(--quiz-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: var(--quiz-transition);
}

.breed-link:hover {
    gap: 10px;
}

/* ========================================
   Meticcio Card (Special)
======================================== */
.breed-card.meticcio-card {
    border-color: var(--quiz-primary);
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.05) 0%, rgba(249, 115, 22, 0.02) 100%);
}

.breed-card.meticcio-card .breed-rank {
    background: var(--quiz-primary);
    color: white;
}

/* ========================================
   Results Actions
======================================== */
.results-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 32px;
}

.results-actions .btn {
    width: 100%;
}

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

.btn-success:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: var(--quiz-shadow-md);
}

/* ========================================
   Share Section
======================================== */
.share-section {
    text-align: center;
    padding-top: 32px;
    border-top: 1px solid var(--quiz-border);
}

.share-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--quiz-text);
    margin: 0 0 16px;
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: var(--quiz-transition);
    text-decoration: none;
}

.share-btn-whatsapp {
    background: #25D366;
    color: white;
}

.share-btn-whatsapp:hover {
    background: #1da851;
    transform: translateY(-2px);
}

.share-btn-facebook {
    background: #1877F2;
    color: white;
}

.share-btn-facebook:hover {
    background: #145dbf;
    transform: translateY(-2px);
}

/* ========================================
   Messages
======================================== */
.quiz-messages {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 14px;
    animation: slideDown 0.3s ease;
}

.quiz-messages.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--quiz-success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.quiz-messages.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--quiz-error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.quiz-messages.info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* ========================================
   Animations
======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 100px;
        padding-top: 16px;
        padding-bottom: 16px;
    }
}

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

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

/* ========================================
   Responsive - Mobile Small Screens
======================================== */
@media (max-width: 479px) {
    .quiz-section {
        padding: 40px 16px 80px;
    }

    .quiz-container {
        padding: 30px 16px;
        margin-left: 8px;
        margin-right: 8px;
        width: calc(100% - 16px);
    }

    .quiz-navigation {
        gap: 10px;
        flex-wrap: nowrap;
    }

    .quiz-navigation .btn {
        padding: 12px 14px;
        font-size: 14px;
        min-width: 0;
        white-space: nowrap;
    }

    .btn-outline {
        flex: 0 0 auto;
        min-width: 90px;
    }

    .btn-primary {
        flex: 1 1 auto;
        min-width: 0;
        max-width: none;
    }

    .question-title {
        font-size: 20px;
    }

    .option-content h3 {
        font-size: 16px;
    }

    .option-content p {
        font-size: 13px;
    }
}

/* Extra small screens - stack buttons vertically if still too narrow */
@media (max-width: 360px) {
    .quiz-section {
        padding: 40px 12px 80px;
    }

    .quiz-container {
        padding: 24px 12px;
        margin-left: 4px;
        margin-right: 4px;
        width: calc(100% - 8px);
    }

    .quiz-navigation {
        flex-direction: column;
        gap: 12px;
    }

    .quiz-navigation .btn {
        width: 100%;
        flex: 0 0 auto;
        padding: 14px 20px;
    }

    .btn-outline {
        min-width: auto;
        order: 2;
    }

    .btn-primary {
        order: 1;
    }
}

/* ========================================
   Responsive - Tablet
======================================== */
@media (min-width: 768px) {
    .quiz-hero {
        padding: 80px 40px 60px;
    }

    .quiz-hero-title {
        font-size: 42px;
    }

    .quiz-hero-subtitle {
        font-size: 18px;
    }

    .quiz-container {
        padding: 50px 60px;
        margin-top: -60px;
    }

    .quiz-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .results-actions {
        grid-template-columns: repeat(2, 1fr);
    }

    .question-title {
        font-size: 28px;
    }
}

/* ========================================
   Responsive - Desktop
======================================== */
@media (min-width: 1024px) {
    .quiz-hero {
        padding: 100px 40px 80px;
    }

    .quiz-hero-title {
        font-size: 48px;
    }

    .quiz-section {
        padding: 60px 40px 100px;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .results-actions {
        grid-template-columns: repeat(3, 1fr);
    }

    .breed-card {
        padding: 28px;
    }

    .breed-image-container {
        width: 120px;
        height: 120px;
    }
}

/* ========================================
   Print Styles
======================================== */
@media print {
    .quiz-hero,
    .quiz-navigation,
    .results-actions,
    .share-section {
        display: none;
    }

    .quiz-results {
        display: block !important;
    }

    .breed-card {
        page-break-inside: avoid;
    }
}
