/**
 * RISP Mobile-First Responsive CSS
 * Comprehensive mobile optimization to prevent overflow
 */

/* ========================================
   BASE MOBILE-FIRST STYLES
   ======================================== */

/* Prevent horizontal overflow on all elements */
* {
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Exception for service cards - prevent character splitting */
section[style*="RISP Services"] a,
section[style*="RISP Services"] a *,
.stats-section a,
.stats-section a * {
    word-break: keep-all !important;
    overflow-wrap: normal !important;
    hyphens: none !important;
}

html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* Images and media */
img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* Tables */
table {
    width: 100%;
    overflow-x: auto;
    display: block;
}

@media (min-width: 768px) {
    table {
        display: table;
    }
}

/* ========================================
   NAVIGATION RESPONSIVE
   ======================================== */

.nav-logo {
    font-size: 1.125rem !important;
    gap: 0.5rem !important;
}

.logo-img {
    height: 32px !important;
}

.logo-text {
    display: none;
}

@media (min-width: 480px) {
    .logo-text {
        display: inline;
        font-size: 1.25rem;
    }
}

@media (min-width: 768px) {
    .nav-logo {
        font-size: 1.5rem !important;
        gap: 1rem !important;
    }
    
    .logo-img {
        height: 40px !important;
    }
    
    .logo-text {
        font-size: 1.5rem;
    }
}

/* Hide nav menu on mobile, show on desktop */
.nav-menu {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 10000;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.nav-menu.active {
    display: flex !important;
    max-height: 500px;
}

.nav-menu a {
    padding: 0.75rem 1rem !important;
    border-bottom: 1px solid #f1f5f9;
}

.nav-menu a:last-child {
    border-bottom: none;
}

@media (min-width: 768px) {
    .nav-menu {
        display: flex !important;
        position: static;
        flex-direction: row;
        padding: 0;
        box-shadow: none;
        max-height: none;
        overflow: visible;
    }
    
    .nav-menu a {
        padding: 0.5rem 0.875rem !important;
        border-bottom: none;
    }
}

/* Mobile menu button */
.nav-toggle,
.mobile-menu-btn {
    display: flex !important;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    z-index: 10001;
}

.nav-toggle span,
.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: #000;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.nav-toggle:hover span,
.mobile-menu-btn:hover span {
    background: #333;
}

@media (min-width: 768px) {
    .nav-toggle,
    .mobile-menu-btn {
        display: none !important;
    }
}

/* ========================================
   HERO SECTION RESPONSIVE
   ======================================== */

.hero {
    min-height: auto !important;
    padding: 0 !important;
}

.hero-title {
    font-size: 1.75rem !important;
    line-height: 1.2 !important;
    margin-bottom: 1rem !important;
}

.hero-subtitle {
    font-size: 0.9375rem !important;
    margin-bottom: 1.5rem !important;
}

@media (min-width: 480px) {
    .hero-title {
        font-size: 2rem !important;
    }
    
    .hero-subtitle {
        font-size: 1rem !important;
    }
}

@media (min-width: 768px) {
    .hero-title {
        font-size: 2.5rem !important;
    }
    
    .hero-subtitle {
        font-size: 1.125rem !important;
    }
}

@media (min-width: 1024px) {
    .hero-title {
        font-size: 3rem !important;
    }
    
    .hero-subtitle {
        font-size: 1.25rem !important;
    }
}

/* ========================================
   SEARCH BOX RESPONSIVE
   ======================================== */

.search-container {
    padding: 1rem !important;
    margin: 0 !important;
}

.search-input {
    font-size: 1rem !important;
    padding: 0.75rem !important;
    width: 100% !important;
}

.search-button {
    width: 100% !important;
    padding: 0.875rem !important;
    font-size: 0.9375rem !important;
    margin-top: 0.75rem !important;
}

@media (min-width: 768px) {
    .search-container {
        padding: 1.5rem !important;
    }
    
    .search-button {
        width: auto !important;
        margin-top: 0 !important;
    }
}

/* ========================================
   STATISTICS CARDS RESPONSIVE
   ======================================== */

.stats-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
    padding: 1rem !important;
}

@media (min-width: 640px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
    }
}

@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        padding: 1.5rem !important;
    }
}

@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 1.5rem !important;
    }
}

@media (min-width: 1280px) {
    .stats-grid {
        grid-template-columns: repeat(7, 1fr) !important;
    }
}

.stat-card {
    padding: 1rem !important;
}

.stat-value {
    font-size: 1.5rem !important;
}

.stat-label {
    font-size: 0.75rem !important;
}

@media (min-width: 768px) {
    .stat-card {
        padding: 1.25rem !important;
    }
    
    .stat-value {
        font-size: 2rem !important;
    }
    
    .stat-label {
        font-size: 0.875rem !important;
    }
}

/* ========================================
   DATA TABLE RESPONSIVE
   ======================================== */

.data-table-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin: 0 !important;
    width: 100% !important;
}

.data-table {
    min-width: 600px !important;
    font-size: 0.8125rem !important;
}

.data-table th,
.data-table td {
    padding: 0.5rem !important;
    white-space: nowrap !important;
}

@media (min-width: 768px) {
    .data-table {
        font-size: 0.875rem !important;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.75rem !important;
    }
}

@media (min-width: 1024px) {
    .data-table {
        min-width: auto !important;
        font-size: 0.9375rem !important;
    }
    
    .data-table th,
    .data-table td {
        padding: 1rem !important;
    }
}

/* ========================================
   CHARTS RESPONSIVE
   ======================================== */

.chart-container {
    position: relative !important;
    height: 250px !important;
    width: 100% !important;
    overflow: hidden !important;
}

@media (min-width: 768px) {
    .chart-container {
        height: 300px !important;
    }
}

@media (min-width: 1024px) {
    .chart-container {
        height: 350px !important;
    }
}

/* ========================================
   RISP SERVICES 2026 RESPONSIVE
   ======================================== */

/* RISP Services Grid - Mobile First */
section[style*="RISP Services"] > .container-wide > div[style*="grid-template-columns: repeat(6, 1fr)"],
.risp-services-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
    padding: 0 1rem !important;
}

@media (min-width: 480px) {
    section[style*="RISP Services"] > .container-wide > div[style*="grid-template-columns: repeat(6, 1fr)"],
    .risp-services-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (min-width: 768px) {
    section[style*="RISP Services"] > .container-wide > div[style*="grid-template-columns: repeat(6, 1fr)"],
    .risp-services-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 1rem !important;
        padding: 0 !important;
    }
}

@media (min-width: 1024px) {
    section[style*="RISP Services"] > .container-wide > div[style*="grid-template-columns: repeat(6, 1fr)"],
    .risp-services-grid {
        grid-template-columns: repeat(6, 1fr) !important;
    }
}

/* RISP Services Card Responsive */
section[style*="RISP Services"] a[style*="padding: 1rem"],
.risp-service-card {
    padding: 0.875rem 0.5rem !important;
    min-height: 100px !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    white-space: normal !important;
}

section[style*="RISP Services"] a svg {
    width: 28px !important;
    height: 28px !important;
}

section[style*="RISP Services"] a div[style*="font-weight: 600"] {
    font-size: 0.8125rem !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
    line-height: 1.3 !important;
}

section[style*="RISP Services"] a div[style*="font-size: 0.75rem"] {
    font-size: 0.6875rem !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
    line-height: 1.3 !important;
}

/* Fix text display in all service card divs */
section[style*="RISP Services"] a > div,
.risp-service-card > div {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
}

@media (min-width: 768px) {
    section[style*="RISP Services"] a[style*="padding: 1rem"],
    .risp-service-card {
        padding: 1rem !important;
        min-height: 120px !important;
    }
    
    section[style*="RISP Services"] a svg {
        width: 32px !important;
        height: 32px !important;
    }
    
    section[style*="RISP Services"] a div[style*="font-weight: 600"] {
        font-size: 0.875rem !important;
    }
    
    section[style*="RISP Services"] a div[style*="font-size: 0.75rem"] {
        font-size: 0.75rem !important;
    }
}

/* ========================================
   PLATFORM ANALYTICS RESPONSIVE
   ======================================== */

/* Platform Analytics Grid - Already responsive with auto-fit */
.stats-section div[style*="grid-template-columns: repeat(auto-fit, minmax(140px, 1fr))"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
    padding: 0 1rem !important;
}

@media (min-width: 480px) {
    .stats-section div[style*="grid-template-columns: repeat(auto-fit, minmax(140px, 1fr))"] {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (min-width: 640px) {
    .stats-section div[style*="grid-template-columns: repeat(auto-fit, minmax(140px, 1fr))"] {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

@media (min-width: 768px) {
    .stats-section div[style*="grid-template-columns: repeat(auto-fit, minmax(140px, 1fr))"] {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
        padding: 0 !important;
    }
}

/* Platform Analytics Card Responsive */
.stats-section a[style*="padding: 0.875rem"] {
    padding: 0.75rem 0.5rem !important;
}

.stats-section a svg {
    width: 24px !important;
    height: 24px !important;
}

.stats-section a div[style*="font-size: 1.5rem"] {
    font-size: 1.25rem !important;
}

.stats-section a div[style*="font-size: 0.75rem"] {
    font-size: 0.6875rem !important;
}

.stats-section a div[style*="font-size: 0.6875rem"] {
    font-size: 0.625rem !important;
}

@media (min-width: 768px) {
    .stats-section a[style*="padding: 0.875rem"] {
        padding: 0.875rem !important;
    }
    
    .stats-section a svg {
        width: 28px !important;
        height: 28px !important;
    }
    
    .stats-section a div[style*="font-size: 1.5rem"] {
        font-size: 1.5rem !important;
    }
    
    .stats-section a div[style*="font-size: 0.75rem"] {
        font-size: 0.75rem !important;
    }
    
    .stats-section a div[style*="font-size: 0.6875rem"] {
        font-size: 0.6875rem !important;
    }
}

/* Section Headers Responsive */
section h2[style*="font-size: 1.75rem"] {
    font-size: 1.375rem !important;
    padding: 0 1rem !important;
}

section p[style*="font-size: 0.9375rem"] {
    font-size: 0.875rem !important;
    padding: 0 1rem !important;
}

@media (min-width: 768px) {
    section h2[style*="font-size: 1.75rem"] {
        font-size: 1.75rem !important;
        padding: 0 !important;
    }
    
    section p[style*="font-size: 0.9375rem"] {
        font-size: 0.9375rem !important;
        padding: 0 !important;
    }
}

/* Section Padding Responsive */
section[style*="padding: 2rem 0"] {
    padding: 1.5rem 0 !important;
}

@media (min-width: 768px) {
    section[style*="padding: 2rem 0"] {
        padding: 2rem 0 !important;
    }
}

/* ========================================
   QUICK ACTIONS / SERVICES RESPONSIVE (Legacy)
   ======================================== */

.quick-actions-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
}

@media (min-width: 640px) {
    .quick-actions-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
    }
}

@media (min-width: 1024px) {
    .quick-actions-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 1.5rem !important;
    }
}

.action-card {
    padding: 1rem !important;
}

.action-icon {
    width: 32px !important;
    height: 32px !important;
}

.action-title {
    font-size: 0.875rem !important;
}

.action-count {
    font-size: 1.25rem !important;
}

@media (min-width: 768px) {
    .action-card {
        padding: 1.5rem !important;
    }
    
    .action-icon {
        width: 40px !important;
        height: 40px !important;
    }
    
    .action-title {
        font-size: 1rem !important;
    }
    
    .action-count {
        font-size: 1.5rem !important;
    }
}

/* ========================================
   UPDATES/LINKS SECTION RESPONSIVE
   ======================================== */

.updates-section {
    padding: 1rem !important;
}

.updates-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
}

@media (min-width: 1024px) {
    .updates-section {
        padding: 2rem !important;
    }
    
    .updates-grid {
        grid-template-columns: 2fr 1fr !important;
        gap: 2rem !important;
    }
}

/* ========================================
   LANGUAGE SELECTOR RESPONSIVE
   ======================================== */

#custom_language_selector {
    top: 10px !important;
    right: 10px !important;
}

#language_dropdown {
    padding: 8px 6px !important;
    font-size: 12px !important;
    height: 36px !important;
    padding-left: 34px !important;
}

@media (min-width: 768px) {
    #custom_language_selector {
        top: 80px !important;
        right: 20px !important;
    }
    
    #language_dropdown {
        padding: 10px 8px !important;
        font-size: 13px !important;
        height: 40px !important;
        padding-left: 38px !important;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Hide on mobile */
.hide-mobile {
    display: none !important;
}

@media (min-width: 768px) {
    .hide-mobile {
        display: block !important;
    }
}

/* Show only on mobile */
.show-mobile {
    display: block !important;
}

@media (min-width: 768px) {
    .show-mobile {
        display: none !important;
    }
}

/* Responsive padding */
.section-padding {
    padding: 1.5rem 1rem !important;
}

@media (min-width: 768px) {
    .section-padding {
        padding: 2rem 1.5rem !important;
    }
}

@media (min-width: 1024px) {
    .section-padding {
        padding: 3rem 2rem !important;
    }
}

/* Responsive margins */
.section-margin {
    margin: 1rem 0 !important;
}

@media (min-width: 768px) {
    .section-margin {
        margin: 2rem 0 !important;
    }
}

@media (min-width: 1024px) {
    .section-margin {
        margin: 3rem 0 !important;
    }
}

/* ========================================
   TOUCH TARGETS (Minimum 44px)
   ======================================== */

button, a, input[type="submit"], input[type="button"] {
    min-height: 44px !important;
    min-width: 44px !important;
}

/* ========================================
   PREVENT ZOOM ON INPUT FOCUS (iOS)
   ======================================== */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea,
select {
    font-size: 16px !important;
}
