/* Dog Behavior Survey Styles - Enhanced Version */
.dbs-landing, .dbs-survey, .dbs-results {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
}

/* Performance optimization - reduce repaints */
* {
    box-sizing: border-box;
}

/* Error Message Styles */
.dbs-error-message {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    text-align: center;
    margin: 40px auto;
}

.dbs-error-message h3 {
    color: #dc3545;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.dbs-error-message p {
    color: #666;
    margin-bottom: 20px;
}

/* Landing Page Styles */
.dbs-header {
    text-align: center;
    margin-bottom: 40px;
}

.dbs-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.dbs-header h1 {
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 15px;
    font-weight: 700;
}

.dbs-header p {
    font-size: 1.2rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

.dbs-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.dbs-feature {
    text-align: center;
    padding: 30px 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dbs-feature:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.dbs-feature-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.dbs-feature h3 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 10px;
    font-weight: 600;
}

.dbs-feature p {
    color: #666;
    font-size: 0.95rem;
}

/* Form Styles */
.dbs-form {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

.dbs-form h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 1.8rem;
    font-weight: 600;
}

.dbs-form-group {
    margin-bottom: 25px;
    position: relative;
}

.dbs-form-group.error input {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.dbs-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.dbs-form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.dbs-form-group input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.dbs-form-group input:invalid {
    border-color: #dc3545;
}

.dbs-button {
    background: linear-gradient(135deg, #007cba, #005a87);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.dbs-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #005a87, #004066);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
    color: white;
    text-decoration: none;
}

.dbs-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.dbs-button-secondary {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    width: auto;
}

.dbs-button-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a6268, #495057);
    color: white;
}

.dbs-error {
    margin-top: 15px;
    padding: 12px;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    animation: slideIn 0.3s ease;
}

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

.dbs-footer {
    text-align: center;
    margin-top: 30px;
    color: #666;
    font-size: 0.9rem;
}

/* Survey Styles */
.dbs-progress {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    border-left: 4px solid #007cba;
}

.dbs-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.dbs-progress-info h3 {
    margin: 0;
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
}

.dbs-progress-percentage {
    font-weight: 600;
    color: #007cba;
    font-size: 1.1rem;
}

.dbs-progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.dbs-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007cba, #005a87);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.dbs-survey h2 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 1.8rem;
    font-weight: 600;
}

.dbs-dog-info {
    text-align: center;
    color: #666;
    margin-bottom: 40px;
    font-size: 1.1rem;
}

.dbs-question {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-in;
    transition: all 0.3s ease;
}

.dbs-question.answered {
    background: #f0f8ff;
    border-color: #007cba;
}

.dbs-question.advancing {
    opacity: 0.7;
    transform: scale(0.98);
}

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

.dbs-question h4 {
    margin: 0 0 25px 0;
    color: #333;
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.4;
}

.dbs-answers {
    display: grid;
    gap: 12px;
}

.dbs-answer {
    display: block;
    padding: 15px 20px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.dbs-answer:hover {
    border-color: #007cba;
    background: #e3f2fd;
    transform: translateX(5px);
}

.dbs-answer.selected {
    background: #e3f2fd;
    border-color: #007cba;
    transform: scale(1.02);
}

.dbs-answer input[type="radio"] {
    margin-right: 12px;
    transform: scale(1.2);
}

.dbs-answer input[type="radio"]:checked + span {
    font-weight: 600;
}

.dbs-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    gap: 15px;
}

/* Results Styles */
.dbs-results {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.dbs-results.loaded {
    opacity: 1;
}

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

.dbs-results-header h1 {
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 15px;
    font-weight: 700;
}

.dbs-results-header p {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 20px;
}

.dbs-breed-stats {
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.dbs-section-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 30px;
    background: white;
    padding: 8px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dbs-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    color: #666;
    flex: 1;
    min-width: 120px;
}

.dbs-tab:hover {
    background: #f8f9fa;
    color: #333;
}

.dbs-tab.active {
    background: #007cba;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 124, 186, 0.3);
}

.dbs-question-result {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    margin-bottom: 25px;
    transition: transform 0.2s ease;
}

.dbs-question-result:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dbs-question-result h4 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
}

.dbs-results-bars {
    display: grid;
    gap: 15px;
}

.dbs-result-bar {
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e9ecef;
    transition: transform 0.2s ease;
}

.dbs-result-bar:hover {
    transform: scale(1.01);
}

.dbs-result-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    font-size: 0.95rem;
}

.dbs-result-label span:first-child {
    font-weight: 500;
    color: #333;
}

.dbs-result-stats {
    font-size: 0.85rem;
    color: #666;
    font-weight: 600;
    background: #e3f2fd;
    padding: 4px 8px;
    border-radius: 4px;
}

.dbs-bar {
    height: 6px;
    background: #e9ecef;
    margin: 0 16px 12px 16px;
    border-radius: 3px;
    overflow: hidden;
}

.dbs-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #007cba, #005a87);
    border-radius: 3px;
    transition: width 0.8s ease-out;
    transform-origin: left;
}

.dbs-no-data {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.dbs-results-actions {
    text-align: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e9ecef;
}

/* Loading states */
.dbs-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.dbs-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #007cba;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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

/* Accessibility improvements */
.dbs-answer:focus-within {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.dbs-button:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dbs-landing, .dbs-survey, .dbs-results {
        padding: 15px;
    }
    
    .dbs-form {
        padding: 25px;
    }
    
    .dbs-question {
        padding: 20px;
    }
    
    .dbs-progress-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .dbs-navigation {
        flex-direction: column;
    }
    
    .dbs-button {
        width: 100%;
    }
    
    .dbs-section-tabs {
        justify-content: center;
    }
    
    .dbs-tab {
        flex: 1;
        min-width: 120px;
        text-align: center;
    }
    
    .dbs-result-label {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .dbs-features {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .dbs-header h1 {
        font-size: 2rem;
    }
    
    .dbs-form-group input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .dbs-answer {
        padding: 12px 16px;
        font-size: 0.9rem;
    }
    
    .dbs-section-tabs {
        flex-direction: column;
    }
    
    .dbs-tab {
        min-width: auto;
    }
}

/* Print styles */
@media print {
    .dbs-navigation,
    .dbs-section-tabs,
    .dbs-results-actions {
        display: none;
    }
    
    .dbs-question-result {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .dbs-button {
        border: 2px solid currentColor;
    }
    
    .dbs-answer {
        border-width: 3px;
    }
    
    .dbs-progress-fill {
        background: currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .dbs-icon {
        animation: none;
    }
}