/**
 * Global Fixes for All Pages
 * Ensures dark mode works on all pages and fixes alignment issues
 */

/* ===========================================
   GLOBAL DARK MODE FIX
   =========================================== */

/* Ensure body background changes in dark mode */
[data-theme="dark"] body {
    background-color: var(--theme-bg-primary, #0f172a) !important;
    color: var(--theme-text-primary, #f8fafc) !important;
}

/* Ensure main content areas respect dark mode */
[data-theme="dark"] main,
[data-theme="dark"] section,
[data-theme="dark"] .container {
    background-color: transparent;
    color: var(--theme-text-primary, #f8fafc);
}

/* Fix white backgrounds in dark mode */
[data-theme="dark"] .hero,
[data-theme="dark"] .section,
[data-theme="dark"] .content-section {
    background-color: transparent !important;
}

/* Ensure all text is visible in dark mode */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
    color: var(--theme-text-primary, #f8fafc) !important;
}

[data-theme="dark"] p,
[data-theme="dark"] li,
[data-theme="dark"] span,
[data-theme="dark"] div {
    color: var(--theme-text-secondary, #cbd5e1);
}

/* Fix cards in dark mode */
[data-theme="dark"] .card,
[data-theme="dark"] .service-card,
[data-theme="dark"] .pricing-card,
[data-theme="dark"] .testimonial-card {
    background: var(--glass-bg, rgba(30, 41, 59, 0.7)) !important;
    border-color: var(--glass-border, rgba(255, 255, 255, 0.1)) !important;
    color: var(--theme-text-primary, #f8fafc);
}

/* Fix buttons in dark mode */
[data-theme="dark"] .btn-outline,
[data-theme="dark"] .btn-secondary {
    background: var(--glass-bg, rgba(30, 41, 59, 0.7));
    border-color: var(--theme-border-accent, #818cf8);
    color: var(--theme-text-primary, #f8fafc);
}

[data-theme="dark"] .btn-outline:hover,
[data-theme="dark"] .btn-secondary:hover {
    background: var(--theme-bg-tertiary, #334155);
}

/* Fix forms in dark mode */
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background: var(--theme-bg-tertiary, #334155) !important;
    border-color: var(--theme-border-primary, #475569) !important;
    color: var(--theme-text-primary, #f8fafc) !important;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--theme-text-tertiary, #94a3b8) !important;
}

/* Fix labels in dark mode */
[data-theme="dark"] label {
    color: var(--theme-text-secondary, #cbd5e1) !important;
}

/* ===========================================
   HEADER ALIGNMENT FIXES
   =========================================== */

/* Fix navigation alignment */
.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    vertical-align: middle;
}

/* Ensure buttons in header are aligned */
header .btn,
header .btn-primary,
header .btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    height: 40px;
    padding: 0 20px;
}

/* Fix header container alignment */
header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ===========================================
   TRUST BADGES ALIGNMENT
   =========================================== */

.hero-trust-indicators,
.trust-indicators {
    display: flex;
    gap: 16px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 32px;
}

.trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    white-space: nowrap;
}

/* ===========================================
   STATISTICS SECTION FIXES
   =========================================== */

/* Ensure stat numbers are properly formatted */
.stat-number,
.impact-number {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 8px;
    display: block;
}

/* Fix stat cards alignment */
.stats-grid,
.impact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    align-items: stretch;
}

.stat-card,
.impact-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px 24px;
}

/* ===========================================
   CARD ALIGNMENT FIXES
   =========================================== */

/* Ensure all cards have equal height */
.services-grid,
.pricing-grid,
.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 32px;
    align-items: stretch;
}

.service-card,
.pricing-card,
.testimonial-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Push buttons to bottom of cards */
.service-card .btn,
.pricing-card .btn {
    margin-top: auto;
}

/* ===========================================
   CONTENT SECTION ALIGNMENT
   =========================================== */

/* Fix section headers */
.section-header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 48px;
}

/* Fix two-column layouts */
.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: center;
}

@media (max-width: 768px) {
    .two-column {
        grid-template-columns: 1fr;
        gap: 32px;
    }
}

/* ===========================================
   FORM ALIGNMENT FIXES
   =========================================== */

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-primary);
}

/* ===========================================
   FOOTER ALIGNMENT FIXES
   =========================================== */

footer {
    background-color: var(--theme-bg-secondary);
}

[data-theme="dark"] footer {
    background-color: var(--theme-bg-secondary, #1e293b);
    color: var(--theme-text-primary, #f8fafc);
}

footer .container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 32px;
}

/* ===========================================
   RESPONSIVE FIXES
   =========================================== */

@media (max-width: 768px) {

    /* Stack elements on mobile */
    .hero-trust-indicators {
        flex-direction: column;
        align-items: stretch;
    }

    .trust-badge {
        justify-content: center;
        width: 100%;
    }

    /* Full width buttons on mobile */
    .hero-actions,
    .cta-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    /* Single column grids on mobile */
    .stats-grid,
    .services-grid,
    .pricing-grid {
        grid-template-columns: 1fr;
    }
}

/* ===========================================
   TEXT ALIGNMENT FIXES
   =========================================== */

/* Ensure proper text alignment */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

/* Fix hero text width on contact page */
.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    line-height: 1.2;
    margin-bottom: 24px;
}

.hero-description {
    line-height: 1.6;
    margin-bottom: 32px;
}

/* ===========================================
   RATING ALIGNMENT FIXES
   =========================================== */

.rating-summary {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.star-distribution {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

/* ===========================================
   UTILITY CLASSES
   =========================================== */

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.gap-sm {
    gap: 8px;
}

.gap-md {
    gap: 16px;
}

.gap-lg {
    gap: 24px;
}

.gap-xl {
    gap: 32px;
}

/* ===========================================
   DARK MODE LINK FIXES
   =========================================== */

[data-theme="dark"] a {
    color: var(--theme-text-accent, #818cf8);
}

[data-theme="dark"] a:hover {
    color: var(--premium-blue, #4facfe);
}

/* ===========================================
   DARK MODE TABLE FIXES
   =========================================== */

[data-theme="dark"] table {
    border-color: var(--theme-border-primary, #475569);
}

[data-theme="dark"] th,
[data-theme="dark"] td {
    border-color: var(--theme-border-primary, #475569);
    color: var(--theme-text-primary, #f8fafc);
}

[data-theme="dark"] thead {
    background: var(--theme-bg-tertiary, #334155);
}

/* ===========================================
   DARK MODE BADGE FIXES
   =========================================== */

[data-theme="dark"] .badge,
[data-theme="dark"] .tag {
    background: var(--theme-bg-tertiary, #334155);
    color: var(--theme-text-primary, #f8fafc);
}