/*
 * SleepCheck Pages Stylesheet
 * Centralized styling for all pages (About, Services, Contact, Products)
 */

/* Remove default padding on all pages */
.about-page main,
.services-page main,
.contact-page main,
.products-page main {
    padding-top: 0 !important;
}

/* Hero Section - Consistent across all pages */
.page-hero {
    background: linear-gradient(135deg, #8DC63F 0%, #7AB635 100%);
    color: white;
    min-height: 350px;
    display: flex;
    align-items: center;
    margin-top: 70px;
    padding: 3rem 0;
}

.page-hero h1,
.page-hero h2,
.page-hero h3,
.page-hero p,
.page-hero .lead {
    color: white !important;
}

/* Section Backgrounds */
.bg-light {
    background-color: #f8f9fa !important;
}

[data-theme="dark"] .bg-light {
    background-color: #2d2d2d !important;
}

/* Section Text Colors - CRITICAL FIX */
section h1,
section h2,
section h3,
section h4,
section h5,
section h6 {
    color: #4A4A4A;
}

[data-theme="dark"] section h1,
[data-theme="dark"] section h2,
[data-theme="dark"] section h3,
[data-theme="dark"] section h4,
[data-theme="dark"] section h5,
[data-theme="dark"] section h6 {
    color: #FFFFFF !important;
}

section p,
section .lead {
    color: #6c757d;
}

[data-theme="dark"] section p,
[data-theme="dark"] section .lead {
    color: #e0e0e0 !important;
}

/* Text muted fix */
.text-muted {
    color: #6c757d !important;
}

[data-theme="dark"] .text-muted {
    color: #b0b0b0 !important;
}

/* Scroll Up Buttons */
.scroll-up-btn {
    position: absolute;
    right: 20px;
    top: 60%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #8DC63F 0%, #7AB635 100%);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    z-index: 50;
    box-shadow: 0 4px 15px rgba(141, 198, 63, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-up-btn:hover {
    background: linear-gradient(135deg, #7AB635 0%, #6AA525 100%);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(141, 198, 63, 0.5);
}

@media (max-width: 768px) {
    .scroll-up-btn {
        right: 12px;
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
}

/* Card Styling */
.card {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.125);
}

[data-theme="dark"] .card {
    background: #2d2d2d !important;
    border-color: #444 !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] .card h1,
[data-theme="dark"] .card h2,
[data-theme="dark"] .card h3,
[data-theme="dark"] .card h4,
[data-theme="dark"] .card h5,
[data-theme="dark"] .card h6 {
    color: #FFFFFF !important;
}

[data-theme="dark"] .card p,
[data-theme="dark"] .card .card-text {
    color: #e0e0e0 !important;
}

/* Product Cards */
.product-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

[data-theme="dark"] .product-card {
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

[data-theme="dark"] .product-card:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.6);
}

/* Category Cards */
.category-card {
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.category-card:hover {
    border-color: #8DC63F;
    background-color: rgba(141, 198, 63, 0.05);
}

[data-theme="dark"] .category-card:hover {
    background-color: rgba(141, 198, 63, 0.15);
}

/* Service Cards */
.service-card {
    transition: transform 0.3s, box-shadow 0.3s;
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2) !important;
}

[data-theme="dark"] .service-card:hover {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6) !important;
}

/* Icon Boxes */
.icon-box,
.service-icon {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mission/Vision Cards */
.mission-vision-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
}

[data-theme="dark"] .mission-vision-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

/* Process Numbers */
.process-number {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #8DC63F 0%, #7AB635 100%);
    color: white;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}

/* CTA Sections */
.cta-section {
    background: #f8f9fa;
}

[data-theme="dark"] .cta-section {
    background: #1a1a1a !important;
}

.cta-section h1,
.cta-section h2,
.cta-section h3,
.cta-section h4,
.cta-section h5,
.cta-section h6,
.cta-section p,
.cta-section .lead {
    color: #4A4A4A;
}

[data-theme="dark"] .cta-section h1,
[data-theme="dark"] .cta-section h2,
[data-theme="dark"] .cta-section h3,
[data-theme="dark"] .cta-section h4,
[data-theme="dark"] .cta-section h5,
[data-theme="dark"] .cta-section h6 {
    color: #FFFFFF !important;
}

[data-theme="dark"] .cta-section p,
[data-theme="dark"] .cta-section .lead {
    color: #e0e0e0 !important;
}

/* Form Elements */
.form-control,
.form-select {
    background-color: white;
    border: 1px solid #ced4da;
    color: #495057;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: #3d3d3d !important;
    border-color: #555 !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] .form-control::placeholder {
    color: #999 !important;
}

/* Borders */
.border-bottom {
    border-bottom: 1px solid rgba(0, 0, 0, 0.125) !important;
}

[data-theme="dark"] .border-bottom {
    border-bottom-color: #444 !important;
}

.border-success {
    border-color: #8DC63F !important;
}

/* Lists */
[data-theme="dark"] ul li,
[data-theme="dark"] ol li {
    color: #e0e0e0 !important;
}

/* Accordion */
[data-theme="dark"] .accordion-item {
    background-color: #2d2d2d !important;
    border-color: #444 !important;
}

[data-theme="dark"] .accordion-button {
    background-color: #3d3d3d !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] .accordion-button:not(.collapsed) {
    background-color: #4d4d4d !important;
    color: #FFFFFF !important;
}

[data-theme="dark"] .accordion-body {
    background-color: #2d2d2d !important;
    color: #e0e0e0 !important;
}

/* Badge */
[data-theme="dark"] .badge {
    color: white !important;
}

/* Small text */
small {
    color: #6c757d;
}

[data-theme="dark"] small {
    color: #b0b0b0 !important;
}

/* Code blocks */
code {
    background-color: #f8f9fa;
    color: #e83e8c;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
}

[data-theme="dark"] code {
    background-color: #3d3d3d !important;
    color: #ff79c6 !important;
}

/* Contact page specific */
.page-header.bg-success {
    background: linear-gradient(135deg, #8DC63F 0%, #7AB635 100%) !important;
}

/* Ensure white background sections are visible in dark mode */
section.bg-white {
    background-color: white !important;
}

[data-theme="dark"] section.bg-white {
    background-color: #1a1a1a !important;
}

/* Map container */
[data-theme="dark"] iframe {
    opacity: 0.8;
}

/* Modal dark mode */
[data-theme="dark"] .modal-content {
    background-color: #2d2d2d !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] .modal-header {
    border-bottom-color: #444 !important;
}

[data-theme="dark"] .modal-footer {
    border-top-color: #444 !important;
}

[data-theme="dark"] .modal-header .btn-close {
    filter: invert(1);
}

/* Alert dark mode */
[data-theme="dark"] .alert {
    background-color: #3d3d3d !important;
    border-color: #555 !important;
    color: #e0e0e0 !important;
}

/* Breadcrumb */
[data-theme="dark"] .breadcrumb {
    background-color: transparent !important;
}

[data-theme="dark"] .breadcrumb-item a {
    color: #8DC63F !important;
}

[data-theme="dark"] .breadcrumb-item.active {
    color: #e0e0e0 !important;
}

/* ==========================================
   MOBILE OPTIMIZATION - Comprehensive
   ========================================== */

/* Small phones (375-430px) - Base mobile styles */
@media (max-width: 430px) {
    body {
        font-size: 14px;
    }

    /* Typography scaling */
    h1, .display-1 { font-size: 1.75rem !important; }
    h2, .display-2 { font-size: 1.5rem !important; }
    h3, .display-3 { font-size: 1.25rem !important; }
    h4, .display-4 { font-size: 1.1rem !important; }
    h5, .display-5 { font-size: 1rem !important; }
    h6 { font-size: 0.9rem !important; }

    .lead {
        font-size: 1rem !important;
    }

    /* Page hero compact */
    .page-hero {
        min-height: 200px;
        margin-top: 60px;
        padding: 1.5rem 0;
    }

    .page-hero h1 {
        font-size: 1.5rem !important;
        margin-bottom: 0.75rem;
    }

    .page-hero .lead {
        font-size: 0.9rem !important;
    }

    /* Section padding reduction */
    section {
        padding: 2rem 0 !important;
    }

    .py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    /* Container padding */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Cards spacing */
    .card {
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Service/Product grids - single column */
    .row > [class*="col-md"],
    .row > [class*="col-lg"] {
        margin-bottom: 1rem;
    }

    /* Icon sizes */
    .service-icon,
    .icon-box {
        height: 80px;
    }

    .service-icon i,
    .icon-box i {
        font-size: 2.5rem !important;
    }

    /* Process numbers */
    .process-number {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }

    /* Form elements - larger for touch */
    .form-control,
    .form-select,
    textarea.form-control {
        padding: 0.75rem;
        font-size: 1rem;
        min-height: 44px;
    }

    textarea.form-control {
        min-height: 120px;
    }

    .form-label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    /* Contact page buttons */
    .contact-page .btn {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    /* Accordion items */
    .accordion-button {
        padding: 1rem;
        font-size: 1rem;
    }

    .accordion-body {
        padding: 1rem;
        font-size: 0.9rem;
    }

    /* Mission/Vision cards */
    .mission-vision-card {
        margin-bottom: 1.5rem;
    }
}

/* Larger phones and small tablets (431-768px) */
@media (min-width: 431px) and (max-width: 768px) {
    /* Page hero */
    .page-hero {
        min-height: 250px;
        margin-top: 60px;
        padding: 2rem 0;
    }

    /* Typography */
    .display-1 { font-size: 2.5rem !important; }
    .display-2 { font-size: 2.25rem !important; }
    .display-3 { font-size: 2rem !important; }
    .display-4 { font-size: 1.75rem !important; }

    /* Section padding */
    section {
        padding: 3rem 0 !important;
    }

    .py-5 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }

    /* Form elements */
    .form-control,
    .form-select {
        min-height: 44px;
    }
}

/* Touch targets - All mobile devices */
@media (max-width: 768px) {
    /* Minimum touch target size */
    .btn,
    button,
    a.btn,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem 1.5rem;
    }

    .btn-sm {
        min-height: 40px;
        padding: 0.5rem 1rem;
    }

    .btn-lg {
        min-height: 48px;
        padding: 0.875rem 2rem;
    }

    /* Link spacing for easier tapping */
    a:not(.btn) {
        padding: 0.25rem 0;
        display: inline-block;
    }

    /* Navigation links */
    .nav-link {
        padding: 0.75rem 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Product/Service cards - full width on mobile */
    .product-card,
    .service-card,
    .category-card {
        margin-bottom: 1.5rem;
    }

    /* Images responsive */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Tables - responsive scroll */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    /* Modal optimization */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-content {
        border-radius: 0.5rem;
    }

    .modal-body {
        padding: 1rem;
    }

    /* POPIA consent modal - mobile friendly */
    #popiaModal .modal-dialog {
        max-width: 95%;
        margin: 1rem auto;
    }

    #popiaModal .modal-body {
        max-height: 70vh;
        overflow-y: auto;
        padding: 1.5rem;
    }

    #popiaModal .modal-body p {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    /* Contact info cards */
    .contact-page .card {
        text-align: center;
        margin-bottom: 1.5rem;
    }

    .contact-page .card i {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }

    /* About page team cards */
    .about-page .col-md-4,
    .about-page .col-lg-3 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 1.5rem;
    }

    /* Services page grid */
    .services-page .col-md-6,
    .services-page .col-lg-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Product detail page */
    .product-detail .row {
        flex-direction: column;
    }

    .product-detail .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 2rem;
    }

    /* Badges - readable size */
    .badge {
        font-size: 0.85rem;
        padding: 0.4em 0.65em;
    }

    /* Alert messages */
    .alert {
        font-size: 0.9rem;
        padding: 1rem;
    }

    /* List items spacing */
    ul li,
    ol li {
        margin-bottom: 0.5rem;
        line-height: 1.6;
    }

    /* Code blocks */
    code {
        font-size: 0.85rem;
        word-wrap: break-word;
    }

    /* Scroll indicator on hero sections */
    .scroll-indicator {
        bottom: 20px;
        font-size: 1.5rem;
    }

    /* Hide elements that don't work well on mobile */
    .d-none-mobile {
        display: none !important;
    }
}

/* Tablets (769-1024px) - Progressive enhancement */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 720px;
    }

    .page-hero {
        min-height: 300px;
    }

    /* Section padding - medium */
    section {
        padding: 3.5rem 0 !important;
    }
}
