/* GritWorks Custom Styles */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&family=Roboto:wght@300;400;500&display=swap');

:root {
    --primary-red: #DC2626;
    --black: #000000;
    --white: #FFFFFF;
    --gray: #4B5563;
    --light-gray: #F3F4F6;
    --dark-gray: #374151;
}

/* Mobile-first responsive typography with better readability */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

@media (max-width: 768px) {
    html {
        font-size: 15px; /* Increased from 14px for better readability */
    }
}

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

body {
    font-family: 'Roboto', sans-serif;
    color: var(--dark-gray);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    color: var(--black);
}

/* Header Styles */
.navbar {
    background-color: var(--white);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem 0;
}

.navbar-brand {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1.8rem;
    color: var(--primary-red) !important;
    text-decoration: none;
}

.logo-container {
    display: flex;
    align-items: center;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-name {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-red);
}

.brand-tagline {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--gray);
    margin-top: -4px;
}

.navbar-nav .nav-link {
    font-weight: 500;
    color: var(--dark-gray) !important;
    margin: 0 0.5rem;
    transition: color 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: var(--primary-red) !important;
}

.btn-primary {
    background-color: var(--primary-red);
    border-color: var(--primary-red);
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: #B91C1C;
    border-color: #B91C1C;
    transform: translateY(-2px);
}

.btn-outline-primary {
    border-color: var(--primary-red);
    color: var(--primary-red);
}

.btn-outline-primary:hover {
    background-color: var(--primary-red);
    border-color: var(--primary-red);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-red) 0%, #B91C1C 100%);
    color: var(--white);
    padding: 5rem 0;
    text-align: center;
}

.hero h1 {
    color: var(--white);
    font-size: 3.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.hero .lead {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.hero .btn {
    font-size: 1.1rem;
    padding: 1rem 2rem;
    margin: 0.5rem;
    border-radius: 0.5rem;
}

/* Card Styles */
.card {
    border: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border-radius: 0.75rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

/* Segmentation Cards */
.segmentation-card {
    cursor: pointer;
    transition: all 0.3s ease;
    height: 100%;
    touch-action: manipulation; /* Improves mobile touch behavior */
}

.segmentation-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(220, 38, 38, 0.2);
}

/* iOS Safari specific mobile scrolling fix - nuclear option */
@media (max-width: 768px) {
    /* Completely eliminate all hover effects and transforms */
    * {
        transition: none !important;
        animation: none !important;
        -webkit-transform: none !important;
        transform: none !important;
    }
    
    .segmentation-card:hover,
    .card:hover,
    .btn:hover {
        transform: none !important;
        box-shadow: inherit !important;
    }
    
    /* Reset all card interactions */
    .segmentation-card,
    .card,
    .mobile-card-container,
    .mobile-card-container * {
        touch-action: auto !important;
        -webkit-touch-callout: default;
        -webkit-user-select: auto;
        user-select: auto;
        pointer-events: auto !important;
        -webkit-overflow-scrolling: touch;
        overflow: visible;
    }
    
    /* Ensure body can scroll properly */
    body {
        -webkit-overflow-scrolling: touch;
        overflow-x: hidden;
        overflow-y: auto;
    }
    
    /* Remove any positioning that might interfere */
    .mobile-card-container {
        position: static !important;
        contain: none !important;
        isolation: auto !important;
    }
    
    /* Make clickable areas completely transparent to touch events except for actual clicks */
    .segmentation-card {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    }
    
    /* Prevent any element from capturing scroll events */
    .mobile-card-container a {
        display: block;
        text-decoration: none;
    }
    
    /* Target the specific "How It Works" section that's having issues */
    section.bg-light {
        touch-action: auto !important;
        overflow: visible !important;
        position: static !important;
    }
    
    section.bg-light .container,
    section.bg-light .row,
    section.bg-light .col-md-6,
    section.bg-light .card,
    section.bg-light .card-body {
        touch-action: auto !important;
        overflow: visible !important;
        position: static !important;
        pointer-events: auto !important;
    }
}

.segmentation-card .card-body {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.segmentation-card .btn {
    pointer-events: none;
    margin-top: auto;
    user-select: none; /* Prevent text selection on mobile */
    -webkit-user-select: none;
}

.segmentation-card .card-title {
    color: var(--black);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.segmentation-card .card-text {
    color: var(--gray);
    flex-grow: 1;
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: var(--light-gray);
    border-bottom: none;
    font-weight: 600;
    color: var(--black);
}

/* Form Styles */
.form-control {
    border-radius: 0.375rem;
    border: 1px solid #D1D5DB;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-red);
    box-shadow: 0 0 0 0.2rem rgba(220, 38, 38, 0.25);
}

.form-label {
    font-weight: 500;
    color: var(--dark-gray);
    margin-bottom: 0.5rem;
}

/* Progress Bar */
.progress {
    height: 0.75rem;
    border-radius: 0.375rem;
    background-color: var(--light-gray);
}

.progress-bar {
    background-color: var(--primary-red);
    border-radius: 0.375rem;
    transition: width 0.3s ease;
}

/* Test Question Styles */
.question-card {
    border-left: 4px solid var(--primary-red);
    margin-bottom: 1.5rem;
}

.question-number {
    color: var(--primary-red);
    font-weight: 700;
    font-size: 1.1rem;
}

.likert-scale {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.likert-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
}

.likert-option input[type="radio"] {
    margin-bottom: 0.5rem;
    transform: scale(1.2);
}

.likert-option label {
    font-size: 0.875rem;
    color: var(--gray);
    cursor: pointer;
}

/* Results Styles */
.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 8px solid var(--primary-red);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-red);
    margin: 0 auto 1rem;
}

.score-breakdown {
    background-color: var(--light-gray);
    padding: 1.5rem;
    border-radius: 0.75rem;
    margin: 1rem 0;
}

.insight-item {
    background-color: var(--white);
    border-left: 4px solid var(--primary-red);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0 0.375rem 0.375rem 0;
}

/* Testimonials */
.testimonial {
    background-color: var(--light-gray);
    padding: 2rem;
    border-radius: 0.75rem;
    margin: 1rem 0;
    position: relative;
}

.testimonial::before {
    content: '"';
    font-size: 4rem;
    color: var(--primary-red);
    position: absolute;
    top: -10px;
    left: 20px;
    font-family: serif;
}

.testimonial-author {
    font-weight: 600;
    color: var(--dark-gray);
    margin-top: 1rem;
}

/* Footer */
.footer {
    background-color: var(--dark-gray);
    color: var(--white);
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer h5 {
    color: var(--white);
    margin-bottom: 1rem;
}

.footer a {
    color: #D1D5DB;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: var(--white);
}

.footer-bottom {
    border-top: 1px solid #6B7280;
    padding-top: 1rem;
    margin-top: 2rem;
    text-align: center;
}

/* Admin Dashboard */
.admin-header {
    background-color: var(--black);
    color: var(--white);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-red) 0%, #B91C1C 100%);
    color: var(--white);
    padding: 2rem;
    border-radius: 0.75rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.stat-number {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero .lead {
        font-size: 1.1rem;
    }
    
    .likert-scale {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .likert-option {
        flex-direction: row;
        justify-content: flex-start;
        width: 100%;
    }
    
    .likert-option input[type="radio"] {
        margin-right: 0.5rem;
        margin-bottom: 0;
    }
    
    .score-circle {
        width: 120px;
        height: 120px;
        font-size: 2rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for better accessibility */
button:focus,
input:focus,
select:focus,
textarea:focus,
a:focus {
    outline: 2px solid var(--primary-red);
    outline-offset: 2px;
}

/* Loading spinner */
.spinner {
    border: 4px solid var(--light-gray);
    border-top: 4px solid var(--primary-red);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* Alert styles */
.alert {
    border-radius: 0.375rem;
    border: none;
    padding: 1rem 1.5rem;
    margin: 1rem 0;
}

.alert-success {
    background-color: #D1FAE5;
    color: #065F46;
}

.alert-danger {
    background-color: #FEE2E2;
    color: #991B1B;
}

.alert-info {
    background-color: #DBEAFE;
    color: #1E40AF;
}

.alert-warning {
    background-color: #FEF3C7;
    color: #92400E;
}

/* Test form radio button styling */
.test-form .question-group {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    border: 1px solid #e9ecef;
}

.test-form .question-title {
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark-gray);
}

.test-form .radio-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.test-form .radio-buttons-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 500px;
}

.test-form .radio-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
}

.test-form .radio-option input[type="radio"] {
    margin: 0;
    transform: scale(1.2);
}

.test-form .radio-labels-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    max-width: 500px;
    margin-top: 0.5rem;
}

.test-form .radio-label {
    font-size: 0.8rem;
    color: var(--gray);
    text-align: center;
    flex: 1;
    line-height: 1.2;
    padding: 0 0.25rem;
}

/* Responsive adjustments for radio buttons */
@media (max-width: 768px) {
    .test-form .radio-buttons-row {
        max-width: 350px;
    }
    
    .test-form .radio-labels-row {
        max-width: 350px;
    }
    
    .test-form .radio-label {
        font-size: 0.75rem;
        padding: 0 0.1rem;
    }
}

/* Additional mobile responsive improvements */
@media (max-width: 768px) {
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .card {
        margin: 10px;
        border-radius: 8px;
    }
    
    .card-body {
        padding: 1.5rem !important;
    }
    
    .btn-lg {
        padding: 12px 24px;
        font-size: 1rem;
    }
    
    h1, .h1 {
        font-size: 1.75rem;
    }
    
    h2, .h2 {
        font-size: 1.5rem;
    }
    
    .navbar-brand {
        font-size: 1.5rem;
    }
}

/* Prevent horizontal scrolling */
.container-fluid, .container {
    max-width: 100%;
    overflow-x: hidden;
}

/* Fix button spacing on mobile */
@media (max-width: 576px) {
    .btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .btn-group {
        display: flex;
        flex-direction: column;
    }
    
    .btn-group .btn {
        border-radius: 4px !important;
        margin-bottom: 5px;
    }
}
