/* Tablet and Mobile Adjustments */

@media screen and (max-width: 768px) {
    .header {
        padding: 0 1.5rem;
    }

    .hero-wrapper {
        flex-direction: row;
        align-items: baseline;
        text-align: left;
    }
    
    /* On smaller tablets, keep 2 columns but reduce gap */
    .models-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    
    .gradient-box {
        height: 160px;
    }
}

@media screen and (max-width: 480px) {
    /* Mobile Phones */
    
    main {
        padding: 1rem; /* Reduce padding to prevent overflow */
        overflow-x: hidden;
    }

    .header {
        padding: 0 1rem;
    }

    .logo {
        font-size: 1.2rem;
        width: 140px; /* Adjust logo container size */
    }

    .hero-static {
        font-size: 1.1rem; /* Reduced for mobile */
    }

    .side-menu {
        width: 60%; /* Slightly wider on mobile for better usability */
        right: -60%;
    }

    /* --- Reorder Home Page Sections --- */
    #home-view {
        display: flex;
        flex-direction: column;
    }

    /* --- 1. Home Page Grid (Table Card) --- */
    .models-grid {
        order: -1; /* Move to top */
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1px; /* Creates the thin lines */
        padding: 0;
        background: linear-gradient(to right, #00F2FF, #FF0090); /* Gradient for lines */
        box-shadow: 0 0 15px rgba(0, 242, 255, 0.3); /* Glowing shadow */
        border-radius: 0; /* No radius */
        margin-bottom: 2rem;
        overflow: hidden;
    }

    /* Hero Section Gap Adjustment */
    .hero-section {
        margin-bottom: 0.5rem;
    }
    /* Separator after Hero (which is visually after Grid in mobile due to order) */
    .models-grid + .separator-line {
        margin-top: 0.5rem;
    }
    
    .gradient-box {
        height: auto;
        min-height: 80px;
        background: #ffffff; /* Pure White on Mobile */
        border: none;
        border-radius: 0;
        margin: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Remove desktop effects */
    .gradient-box::before { display: none; } /* Keep before hidden, use after for line */
    .box-content {
        position: static;
        background: transparent;
        padding: 10px;
        width: 100%;
    }

    .box-content h3 {
        font-size: 0.8rem;
        margin-bottom: 5px;
    }

    .box-value {
        position: static;
        font-size: 1.2rem;
    }

    .slider-dots {
        display: none; /* Remove slider dots */
    }

    /* Dual Action Row Mobile */
    .dual-action-container {
        padding: 0 1rem;
    }

    /* --- 2. Select Model Row --- */
    .filter-row {
        flex-wrap: nowrap;
        gap: 10px;
        margin-bottom: 2rem;
    }

    .filter-label {
        font-size: 0.9rem;
        white-space: nowrap;
    }

    .select-wrapper {
        min-width: unset;
        width: calc(50% - 5px); /* Adjusted width for gap */
    }

    .custom-select-trigger {
        padding: 0 10px;
        height: 40px;
        font-size: 0.85rem;
    }

    /* Thinner gradient border */
    .custom-select-trigger::after {
        inset: 1px; /* Thin border */
        border-radius: 0; /* No radius */
    }

    /* Remove radius from wrapper */
    .select-wrapper, .custom-select-trigger {
        border-radius: 0;
    }

    /* Ensure Filter Row is relative for full width options */
    .filter-row {
        position: relative;
    }

    /* Make wrapper static so options position relative to row (Unified) */
    .filter-row .select-wrapper {
        position: static;
    }

    /* Select Options: 2 Columns Grid, Full Width, No Gradient Border */
    .filter-row .custom-options {
        display: none; /* Hidden by default */
        grid-template-columns: 1fr 1fr;
        width: 100%;
        left: 0;
        border-radius: 0;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
        background: var(--bg-dark);
        border: none;
    }
    
    /* Remove desktop gradient border effects */
    .filter-row .custom-options::before,
    .filter-row .custom-options::after {
        display: none;
    }

    .filter-row .select-wrapper.open .custom-options {
        display: grid;
    }
    
    /* Options Dividers - Gradient */
    .filter-row .custom-option {
        text-align: center;
        border: none;
        position: relative;
    }
    
    /* Bottom Gradient Divider */
    .filter-row .custom-option::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 1px;
        background: linear-gradient(to right, #00F2FF, #FF0090);
        opacity: 0.5;
    }

    /* Vertical Gradient Divider (Odd items) */
    .filter-row .custom-option:nth-child(odd)::before {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        height: 100%;
        width: 1px;
        background: linear-gradient(to bottom, #00F2FF, #FF0090);
        opacity: 0.5;
    }

    /* Model Page Select Triggers - Align Left */
    .filter-row.dual-filter .custom-select-trigger {
        justify-content: flex-start;
        padding-left: 15px;
    }

    /* Model Page Mobile Adjustments */
    #modelResultsGrid {
        grid-template-columns: repeat(2, 1fr); /* Force 2 Columns on mobile */
        gap: 10px;
        background: none; /* Reset inherited gradient from .models-grid */
        box-shadow: none; /* Reset inherited shadow */
        overflow: visible; /* Allow shadows to show */
        padding-bottom: 4rem; /* Restore padding */
    }

    /* --- 3. Posts Grid (Model Post Box) --- */
    .posts-grid {
        display: grid;
        grid-template-columns: 1fr 1fr; /* 2 Cards per row */
        gap: 10px;
    }

    .post-card {
        display: flex;
        flex-direction: column;
        position: relative;
        height: auto;
        min-height: 200px;
        padding: 15px 10px 50px 10px; /* Space for bottom button */
        background: transparent; /* Remove background */
        border: none; /* Remove border */
        box-shadow: 0 0 15px rgba(0, 242, 255, 0.3); /* Shadow effect only */
        border-radius: 12px; /* Ensure radius matches button */
    }

    /* Hide elements */
    .post-desc, .like-option, .model-label, .post-meta-row::after, .meta-label, .share-btn {
        display: none;
    }
    
    /* Force hide share btn with importance if needed */
    .share-btn { display: none !important; }

    /* Icon (Logo) - Center Row 2 */
    .post-details {
        background: transparent; /* Ensure no white bg */
    }

    .post-thumbnail {
        height: auto;
        width: auto;
        background: none;
        border: none;
        position: absolute;
        top: 50px; /* Adjusted gap */
        left: 50%;
        transform: translateX(-50%);
        padding: 0;
        font-size: 2.5rem; /* Bigger size */
        z-index: 2;
    }

    /* Meta Row Reset */
    .post-meta-row {
        display: contents;
    }

    /* Value (Model No) - Row 1 Left */
    .meta-box:nth-child(1) {
        position: absolute;
        top: 10px;
        left: 10px;
        width: auto;
        padding: 0;
        font-weight: 700;
        font-size: 1rem;
        border: none;
        background: none;
        background: linear-gradient(to right, #00F2FF, #FF0090); /* Gradient Text */
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        font-weight: 400; /* Remove Bold */
    }

    /* Name (Row 3 Center - Below Logo) */
    .post-details h4 {
        position: absolute;
        top: 110px; /* Below Logo with gap */
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        margin: 0;
        font-size: 0.9rem;
        color: #fff;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 90%;
        text-align: center;
        font-weight: 400; /* Remove Bold */
    }

    /* Category (Row 1 Center) */
    .meta-box:nth-child(2) {
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        padding: 0;
        font-size: 0.9rem;
        color: var(--primary);
        border: 1px solid var(--primary); /* Border Box */
        border-radius: 4px;
        background: none;
        text-transform: capitalize;
        width: fit-content;
        padding: 2px 8px;
    }

    /* View Details Button (Bottom Attached - Full Width) */
    .post-actions {
        position: absolute;
        bottom: 0;
        left: 0;
        transform: none;
        width: 100%;
        padding: 0;
    }

    .view-btn::before {
        display: none; /* Remove running gradient */
    }

    .view-btn::after {
        display: none; /* Remove inner bg */
    }

    .view-btn {
        padding: 12px;
        font-size: 0.8rem;
        height: auto;
        width: 100%;
        white-space: nowrap;
        flex: none;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 8px;
        border: none;
        border-radius: 0 0 12px 12px; /* Match box bottom radius */
        box-shadow: 0 -5px 15px rgba(0, 242, 255, 0.3); /* Top Shadow Only */
        background: rgba(3, 0, 40, 0.95);
    }

    /* --- 4. More Models Button (Keep Gradient Effect) --- */
    .more-models-row {
        margin-bottom: 1rem; /* Reduce gap */
    }

    .more-models-row .view-btn {
        padding: 12px 30px;
        font-size: 1rem;
        width: auto;
        border-radius: 0; /* Remove radius */
        box-shadow: none; /* Remove shadow to prioritize border */
    }

    .more-models-row .view-btn::before {
        display: block; /* Enable gradient run */
    }

    .more-models-row .view-btn::after {
        display: block;
        inset: 1px;
        border-radius: 0;
        background: var(--bg-dark);
    }

    /* Contact Form Gap */
    .contact-form {
        margin-top: 5%;
    }

    /* --- 6. Contact Us --- */
    .contact-actions {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .send-msg-btn {
        border: none;
        border-radius: 8px;
        box-shadow: 0 0 10px rgba(0, 242, 255, 0.5);
        width: 95%;
        font-size: 1rem;   
        font-weight: 480; 
        height: 40px;
        padding: 0;
    }
    .send-msg-btn::before, .send-msg-btn::after {
        display: none;
    }

    /* Contact Icons */
    .contact-icons {
        margin-top: 15px;
        display: flex;
        gap: 20px;
        width: auto;
    }

    .c-icon {
        font-size: 1.8rem;
        display: flex;
        align-items: center;
        text-decoration: none; /* Remove underline */
    }

    .c-icon i {
        color: rgb(3, 0, 40);
        font-size: 1.6rem; /* 5% increase */
        background: none;
        -webkit-text-fill-color: initial;
    }

    /* --- 7. Footer --- */
    .social-icon {
        font-size: 1.8rem;
       
    }

   
    /* FAQ Title */
    .section-title {
        font-size: 1.4rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding: 0 10px;
    }

    .team-slider-container {
        width: 100%;
        max-width: 100%; /* Allow edge to edge on mobile */
    }

    /* Footer Address */
    .footer-address {
        position: relative;
        padding: 15px 20px;
        background: linear-gradient(135deg, #f0f9ff, #ffe4f5);
        border-left: none;
        text-align: center;
        margin: 0 auto 2rem auto;
        width: 90%;
        border-radius: 8px;
    }

    /* Allow text wrap */
    .footer-address p {
        visibility: visible;
        position: static;
        height: auto;
        white-space: normal;
        color: rgb(3, 0, 40);
        font-size: 0.9rem;
    }
    .footer-address p::after {
        content: none;
    }

    .copyright-box {
        width: calc(100% + 2rem); /* Full width based on new 1rem padding */
        margin-left: -1rem;
        margin-right: -1rem;
        background: var(--bg-dark);
        border-top: 2px solid transparent; /* Placeholder for gradient */
        padding: 1rem;
        /* Re-apply gradient border logic for full width if needed, 
           but existing ::before works if positioned correctly relative to this box */
    }
    
    .copyright-box::before {
        width: 100%;
    }

    .copyright-box p {
        font-size: 0.95rem; /* Legibility increase */
    }

    /* Med-Social Mobile Adjustments */
    .med-social-container {
        padding: 10px;
        gap: 20px;
    }
    .med-social-card {
        width: 100%;
        min-height: auto;
    }

    /* Dynamic Model Sections Mobile */
    .category-grid {
        padding: 0 1rem;
    }

    .category-header {
        padding-right: 1rem;
    }

    .cat-header-left {
        font-size: 1rem;
        padding: 10px 20px 10px 3%; /* Slightly more padding on mobile */
    }

    .model-grid-unified {
        grid-template-columns: repeat(2, 1fr); /* Force 2 columns on mobile */
        gap: 15px;
        max-width: 100%;
    }

    /* --- Sub-Model Page Mobile --- */
    .spec-table-wrapper {
        background: transparent;
        border: none;
        box-shadow: none;
        height: auto;
    }

    .spec-table thead {
        display: none;
    }

    .spec-table, .spec-table tbody, .spec-table tr, .spec-table td {
        display: block;
        width: 100%;
    }

    .spec-table tr {
        margin-bottom: 20px;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 15px;
        background: #fff;
        box-shadow: 0 5px 15px rgba(0,0,0,0.03);
    }

    .spec-table td {
        text-align: right;
        padding-left: 50%;
        position: relative;
        border-bottom: 1px solid #f1f5f9;
        padding-top: 10px;
        padding-bottom: 10px;
        word-wrap: break-word;
        white-space: normal;
    }

    .spec-table td:last-child {
        border-bottom: none;
        display: flex;
        justify-content: space-between;
        padding-left: 15px;
        gap: 10px;
    }

    .spec-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        text-align: left;
        font-weight: 700;
        color: rgb(3, 0, 40);
    }

    .spec-table td[data-label="Action"]::before {
        display: none;
    }
    
    .sub-model-contact {
        padding: 1.5rem;
    }
}

/* --- Tablet View Specifics (481px to 1024px) --- */
@media screen and (min-width: 481px) and (max-width: 1024px) {
    
    /* 1. Hero Section: Equal margins */
    .hero-wrapper {
        margin: 0 2rem;
        justify-content: center;
        text-align: center;
    }

    /* 2. Models Grid (Top): 3 Boxes per row */
    .models-grid {
        grid-template-columns: repeat(3, 1fr);
        padding: 0 4rem 2rem 4rem;
        gap: 1.5rem;
    }

    /* 3. Select Model Row: Center */
    .filter-row {
        justify-content: center;
        gap: 2rem;
    }

    /* 4. Posts Grid (Model Post Box): 2 Boxes per row */
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
        padding: 0 4rem; /* Proper width adjustment */
    }

    .more-models-row {
        justify-content: center;
        margin-top: 1rem;
    }

    /* 6. Full Width Sections Wrapper */
    .partners-section, .team-section, .contact-section, .faq-section {
        width: calc(100% + 4rem);
        margin-left: -2rem;
        margin-right: -2rem;
        padding-left: 2rem;
        padding-right: 2rem;
    }

    /* 7. Contact Us: 50% Width, Center, Icons Right */
    .contact-section {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .contact-form {
        width: 50%;
    }
    .contact-actions {
        justify-content: space-between;
    }
    .c-icon i {
        color: var(--primary);
    }

    /* 8. FAQ Center */
    .faq-section {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .faq-container {
        width: 100%;
        max-width: 700px;
    }

    /* 9. Footer: 3 Columns, Social Center of Row */
    .footer {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        text-align: left;
        padding: 2rem;
        gap: 1.5rem;
    }
    .footer-links-container { 
        display: flex; 
        flex-direction: column; 
        gap: 20px; 
    }
    .footer-column { width: 100%; border-radius: 20px; margin: 0; }
    .footer-column:first-child { border-radius: 20px; }
    .footer-column:last-child { border-radius: 20px; }

    .social-media-container {
        grid-column: 3;
        grid-row: 1;
        justify-content: center; /* Center in the column */
        margin-bottom: 0;
        align-self: start;
    }
    .footer-address {
        grid-column: 3;
        grid-row: 2;
        margin: 0;
        padding: 15px;
        background: linear-gradient(135deg, #f0f9ff, #ffe4f5);
        border-left: none;
        border-radius: 8px;
        align-self: start;
    }
    .copyright-box {
        grid-column: 1 / -1;
        grid-row: 3;
        margin-top: 2rem;
        width: calc(100% + 4rem);
        margin-left: -2rem;
        text-align: center;
    }
}

/* --- Tablet View Specifics (481px to 1024px) --- */
@media screen and (min-width: 481px) and (max-width: 1024px) {
    
    /* 1. Hero Section */
    .hero-wrapper {
        margin: 0 4rem;
        justify-content: center;
        text-align: center;
    }

    /* 2. Models Grid (3 Columns, Equal Gap) */
    .models-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
        padding: 0 10%; /* Equal gap for centering */
    }

    /* 3. Select Model Row (Desktop Style: Inline) */
    .filter-row {
        padding: 0 10%;
        justify-content: space-between;
        align-items: center;
    }

    /* Hide Dropdown Trigger */
    .filter-row:not(.dual-filter) .custom-select-trigger {
        display: none;
    }

    /* Show Options Inline */
    .filter-row:not(.dual-filter) .custom-options {
        display: flex !important;
        position: static;
        background: transparent;
        border: none;
        border-radius: 0;
        padding: 0;
        width: auto;
        box-shadow: none;
        grid-template-columns: none; /* Reset grid from mobile */
    }
    
    /* Remove mobile/desktop specific borders */
    .filter-row:not(.dual-filter) .custom-options::before,
    .filter-row:not(.dual-filter) .custom-options::after {
        display: none;
    }

    .filter-row:not(.dual-filter) .custom-option {
        padding: 5px 10px;
        background: transparent;
        border: none;
        text-align: left;
    }
    
    .filter-row:not(.dual-filter) .custom-option::after,
    .filter-row:not(.dual-filter) .custom-option::before {
        display: none;
    }

    .filter-row:not(.dual-filter) .custom-option.selected {
        background: rgba(0, 242, 255, 0.1);
        color: var(--primary);
        border-radius: 4px;
    }

    /* 4. Posts Grid (Center with gap) */
    .posts-grid {
        padding: 0 10%;
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }

    /* 6. Contact Us (50% Width) */
    .contact-section {
        width: 100%;
        margin: 0 auto 2rem auto;
        max-width: none;
    }
    
    .contact-actions {
        display: flex;
        justify-content: flex-start;
        align-items: center;
    }
    
    .send-msg-btn {
        width: 40%;
        margin-right: 10%;
        flex: none;
    }
    
    .contact-icons {
        display: flex;
        gap: 20px;
        font-size: 1.8rem;
    }

    /* FAQ Section */
    .faq-section {
        max-width: 800px;
        margin: 0 auto;
    }

    /* 7. Footer Layout (3 Columns) */
    .footer {
        display: grid;
        grid-template-columns: 1fr;
        text-align: left;
        padding: 3rem 2rem;
        gap: 4rem; /* Increased gap */
    }
    .footer-links-container { display: flex; flex-direction: column; gap: 20px; }
    .footer-right-col { text-align: center; }
    
    .copyright-box {
        grid-column: 1 / -1;
        margin-top: 0rem;
        width: 80%;
        margin-left: auto;
        margin-right: auto;
        border-radius: 8px;
    }
}

/* --- Mobile Layout Adjustments (Max-width 768px) --- */
@media screen and (max-width: 768px) {
    /* Contact Us Section Spacing */
    .contact-section {
        padding-bottom: 30px;
    }
    
    .contact-actions {
        flex-direction: column;
    }

    /* FAQ Heading & Divider */
    .faq-section .section-title {
        font-size: 1.5rem;
    }

    .faq-section {
        border-bottom: 1px solid rgb(3, 0, 40);
        padding-bottom: 2rem;
        margin-bottom: 2rem;
    }

    /* Footer Split (Explore & Connect) */
    .footer-links-container {
        flex-direction: column;
        align-items: center;
        gap: 3rem;
        padding: 2rem 1rem;
    }

    .footer-column {
        width: 100%;
        max-width: 300px;
        padding: 0;
        align-items: center !important;
        text-align: center !important;
    }

    .footer-column h4 {
        justify-content: center;
        width: 100%;
    }

    #footerExploreLinks, 
    #footerConnectLinks {
        padding-left: 0;
        text-align: center;
        width: 100%;
    }
}

/* --- Small Mobile Layout Adjustments (Extended to Max-width 480px) --- */
@media screen and (max-width: 480px) {
    /* 1. Notice Section Fix */
    .announcement-icon i {
        color: rgb(3, 0, 40) !important;
        font-weight: 600; /* Ensure sharpness */
    }

    /* 2. Contact Us Row Optimization */
    .contact-actions {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between;
        gap: 10px;
    }

    .send-msg-btn {
        width: 65% !important;
        margin-right: 0 !important;
        font-size: 0.9rem;
        padding: 0 10px;
        height: 45px; /* Ensure height matches icons roughly */
    }

    .contact-icons {
        margin-top: 0 !important;
        width: auto !important;
        gap: 12px !important;
        justify-content: flex-end;
        flex: 1;
        display: flex;
        align-items: center;
    }
    
    .c-icon {
        font-size: 1.6rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* 3. FAQ Section Enhancements */
    .faq-section .section-title {
        font-size: 1.1rem !important;
    }

    .faq-item {
        background: linear-gradient(135deg, #f0f9ff, #ffe4f5) !important;
        border: none !important;
        border-radius: 10px !important;
        margin-bottom: 10px !important;
    }

    .faq-question {
        color: rgb(3, 0, 40) !important;
        padding: 15px !important;
    }

    .faq-question i {
        color: rgb(3, 0, 40) !important;
    }
    
    .faq-item.active .faq-question i {
        color: rgb(3, 0, 40) !important;
    }

    .faq-answer p {
        color: rgb(3, 0, 40) !important;
        padding: 0 15px 15px 15px !important;
    }

    /* 4. Footer Column Split */
    .footer-links-container {
        flex-direction: row !important;
        flex-wrap: nowrap !important; /* Keep in one row */
        align-items: flex-start !important;
        gap: 10px !important;
        padding: 2rem 5px !important;
    }

    .footer-column {
        width: 50% !important;
        max-width: none !important;
        padding: 0 5px !important;
        align-items: center !important;
        text-align: center !important;
    }
    
    .footer-column h4 {
        width: 100%;
        justify-content: center;
        font-size: 0.85rem;
        padding: 8px 5px;
        white-space: nowrap;
    }
    
    #footerExploreLinks, 
    #footerConnectLinks {
        padding-left: 0;
        text-align: center;
        width: 100%;
    }
    
    .footer-column a {
        font-size: 0.85rem;
    }

    /* Official Website Section Mobile Refinements */
    .footer-right-col {
        margin-top: 0.5rem !important; /* 50% gap reduction */
        padding: 0 5px;
    }

    .official-website-section {
        align-items: flex-start !important; /* Align content left */
        width: 100%;
    }

    .official-web-header {
        align-self: center !important; /* Keep title centered */
        margin-bottom: 20px;
    }

    .official-links-container {
        width: 100%;
        align-items: flex-start !important;
    }

    .official-link-row {
        width: 100%;
    }

    .official-link-pill {
        border-radius: 0 !important; /* Rectangular */
        border: none !important;
        background: linear-gradient(135deg, #f0f9ff, #ffe4f5) !important; /* Highlight transparent feel */
        width: auto !important;
    }
}
