:root {
    /* Light theme (default) */
    --background-color: #ffffff;
    --card-color: #f1f1f1;
    --text-color: #0c0c0d;
    --secondary-text-color: #737373;
    --accent-color: #555555;
    --hover-color: #e0e0e2;
    --button-color: #f1f1f1;
    --button-text: #0c0c0d;
    --input-bg: #ffffff;
    --input-text: #0c0c0d;
    --input-border: #e1e1e1;
}

[data-theme="dark"] {
    /* Dark theme - Firefox Developer Edition colors */
    --background-color: #1c1b22;
    --card-color: #2a2a2e;
    --text-color: #f9f9fa;
    --secondary-text-color: #b1b1b3;
    --accent-color: #939395;
    --hover-color: #3d3d42;
    --button-color: #35343d;
    --button-text: #f9f9fa;
    --input-bg: #1c1b22;
    --input-text: #f9f9fa;
    --input-border: #35343d;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1.15rem;
    line-height: 1.6;
    letter-spacing: 0.05em;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-font-smoothing: antialiased;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Body visibility - removed, not needed with new system */

.w3-card {
    background-color: var(--card-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Dark theme - border and shadow for accordions */
[data-theme="dark"] .w3-border {
    border-color: #3d3d42 !important;
}

[data-theme="dark"] .w3-card {
    box-shadow: 0 2px 5px 0 rgba(0,0,0,0.4), 0 2px 10px 0 rgba(0,0,0,0.3) !important;
}

.w3-light-gray {
    background-color: var(--card-color) !important;
    color: var(--text-color) !important;
}

.w3-center.w3-text-gray {
    color: var(--secondary-text-color) !important;
}

/* Theme toggle button */
.theme-toggle {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--button-color);
    color: var(--button-text);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 2;
    border: none;
    font-size: 24px;
    /* box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); */
    transition: background-color 0.3s ease, color 0.3s ease;
}

.theme-toggle:hover {
    background-color: var(--hover-color);
}

/* Hover styling for all buttons */
button:hover:not(#scrollToTopBtn),
.w3-button:hover,
.w3-bar-item:hover,
.icon-button:hover {
    background-color: var(--hover-color) !important;
    color: var(--text-color) !important;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Preserve specific brand colors on hover */
/*
.w3-hover-green:hover { color: #4CAF50 !important; }
.w3-hover-purple:hover { color: #9C27B0 !important; }
.w3-hover-red:hover { color: #F44336 !important; }
.w3-hover-blue:hover { color: #2196F3 !important; }
*/

/* Accordion button hover styling */
button[onclick^="toggleAccordion"]:hover {
    background-color: var(--hover-color) !important;
    color: var(--text-color) !important;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Submit button styling - Theme aware */
#whatsapp-submit,
#email-submit {
    background-color: var(--button-color) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--accent-color);
    transition: all 0.3s ease;
}

/* Submit button hover styling */
#whatsapp-submit:hover,
#email-submit:hover {
    background-color: var(--hover-color) !important;
    color: var(--text-color) !important;
    opacity: 0.9;
    transition: all 0.3s ease;
}

/* WhatsApp icon color */
/*
#whatsapp-submit i {
    color: #25D366;
}
*/

/* Email icon color */
/*
#email-submit i {
    color: #0078d4;
}

/* Dark mode adjustments for icons */
[data-theme="dark"] #whatsapp-submit i,
[data-theme="dark"] #email-submit i {
    color: var(--accent-color);
}

/* Preserve dark gray hover color for other buttons that need it */
.w3-hover-dark-gray:hover:not(#whatsapp-submit):not(#email-submit) {
    color: #fff !important;
    background-color: #3a3a3a !important;
}

.avatar-container {
    display: flex;
    justify-content: center;
}

.icon-button {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 5px auto;
    color: var(--button-text) !important;
    background-color: var(--button-color) !important;
}

/* Chevron animation */
.accordion-icon {
    transition: transform 0.3s ease;
    display: inline-block;
    color: var(--text-color);
}

.accordion-icon.rotate {
    transform: rotate(180deg);
    color: var(--accent-color);
}

/* Responsive rows */
.responsive-container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 auto !important;
    box-sizing: border-box;
    overflow-x: hidden;
}

.responsive-row {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Adjust columns to be fully responsive */
@media (max-width: 600px) {
    .theme-toggle {
        width: 48px !important;
        height: 48px !important;
        font-size: 24px !important;
    }

    #floatingWhatsAppBtn {
        width: 48px !important;
        height: 48px !important;
        font-size: 24px !important;
    }

    #scrollToTopBtn {
        width: 48px !important;
        height: 48px !important;
        font-size: 24px !important;
    }

    .responsive-col {
        width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        box-sizing: border-box;
    }
    
    /* Fix for any possible overflow from w3-container class */
    .w3-container {
        padding-left: 8px !important;
        padding-right: 8px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    

    
    /* Ensure all elements respect container width */
    *, *:before, *:after {
        box-sizing: border-box;
    }
}

/* Floating WhatsApp Button */
#floatingWhatsAppBtn {
    display: flex; /* Always visible */
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #4CAF50;
    color: white;
    font-size: 24px;
    text-decoration: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
    transition: all 0.3s ease;
}

#floatingWhatsAppBtn:hover {
    background-color: #45a049 !important; /* Darker green for hover */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] #floatingWhatsAppBtn {
    background-color: #4CAF50 !important;
    color: white !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] #floatingWhatsAppBtn:hover {
    background-color: #45a049 !important; /* Darker green for hover */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Scroll To Top button */
#scrollToTopBtn {
    display: none;
    /* Hidden by default */
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99;
    width: 64px;
    height: 64px;
    border: none;
    outline: none;
    background-color: #2196F3;
    color: white;
    cursor: pointer;
    border-radius: 50%;
    font-size: 32px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
}

#scrollToTopBtn:hover {
    background-color: #1976D2 !important;
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
    color: white !important;
}

/* Form input styling */
input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
textarea,
select {
    background-color: var(--input-bg);
    color: var(--input-text);
    border: 1px solid var(--input-border);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background-color: var(--input-bg);
    color: var(--input-text);
    border-color: var(--input-border);
}

[data-theme="dark"] input::placeholder {
    color: var(--secondary-text-color);
}

/* Input focus styling for all themes */
input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent-color) !important;
    border-width: 2px !important;
    outline: none;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
}

/* Dark mode specific focus styling */
[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
    border-color: var(--accent-color) !important;
    outline: none;
}

/* Allow only vertical resizing for textareas */
textarea {
    resize: vertical;
    min-height: 100px;
    transition: height 0.2s ease;
}

/* Remove margin-bottom from buttons section */
.w3-section {
    margin-bottom: 0px !important;
}

/* Sticky Messages Styling */
.sticky-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2000;
    margin: 0;
    padding: 16px;
    box-sizing: border-box;
    border-radius: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    font-family: Arial, Helvetica, sans-serif;
    display: none; /* Hidden by default */
}

.success-message {
    background-color: #4caf50 !important;
}

.error-message {
    background-color: #f44336 !important;
}

[data-theme="dark"] .sticky-message {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.sticky-message h3 {
    margin-top: 0;
    font-size: 1.3rem;
    color: #ffffff !important;
}

/* Bottom Sticky Messages Styling */
.bottom-sticky-message {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    z-index: 2000 !important;
    margin: 0 !important;
    padding: 16px !important;
    box-sizing: border-box !important;
    border-radius: 0 !important;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2) !important;
    transition: all 0.3s ease !important;
    font-family: Arial, Helvetica, sans-serif !important;
    display: none !important; /* Hidden by default */
}

[data-theme="dark"] .bottom-sticky-message {
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.4) !important;
}

.bottom-sticky-message h3 {
    margin-top: 0 !important;
    font-size: 1.3rem !important;
}

/* Ensure the upload message shows when JavaScript sets display: block */
#uploadMessage[style*="display: block"] {
    display: block !important;
    visibility: visible !important;
}

/* Upload message specific styling - keep text black on yellow background */
#uploadMessage h3 {
    color: #000000 !important;
}

#uploadMessage p {
    color: #000000 !important;
}

#uploadMessage .w3-button {
    color: #000000 !important;
}

.sticky-message p {
    margin-bottom: 0;
    color: #ffffff !important;
}

.sticky-message .w3-button {
    color: #ffffff !important;
    background-color: transparent !important;
    transition: background-color 0.3s ease;
}

.sticky-message .w3-button:hover {
    background-color: rgba(255, 255, 255, 0.2) !important;
}

@media (max-width: 600px) {
    .sticky-message {
        padding: 12px;
    }
    
    .sticky-message h3 {
        font-size: 1.1rem;
    }
    
    .sticky-message p {
        font-size: 0.9rem;
    }
}

/* Instagram Grid Styles */
.instagram-grid-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    box-sizing: border-box;
}

.instagram-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
    /* Performance optimizations */
    will-change: transform;
    contain: layout style paint;
}

.instagram-post-wrapper {
    background-color: var(--card-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    /* 4:5 aspect ratio (portrait) - modern browsers */
    aspect-ratio: 3 / 4;
    /* Performance optimizations */
    will-change: transform;
    contain: layout style paint;
    transform: translateZ(0); /* Force hardware acceleration */
}

/* Fallback for browsers that don't support aspect-ratio */
@supports not (aspect-ratio: 3 / 4) {
    .instagram-post-wrapper {
        height: 0;
        padding-bottom: 133.333%; /* 4/3 = 1.3333 = 133.333% for 3:4 aspect ratio */
        position: relative;
    }

    .instagram-post-wrapper .instagram-media {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}

.instagram-post-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .instagram-post-wrapper {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .instagram-post-wrapper:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Dark theme for Instagram embeds - darken without inverting */
[data-theme="dark"] .instagram-post-wrapper {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .instagram-post-wrapper iframe,
[data-theme="dark"] .instagram-media {
    filter: brightness(0.85) contrast(1.1);
}

.instagram-post-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
    background-color: var(--card-color);
}

/* Instagram blockquote styling for proper 4:5 aspect ratio */
.instagram-post-wrapper .instagram-media {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    min-width: auto !important;
    margin: 0 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Ensure Instagram content (images and videos) fills the container properly */
.instagram-post-wrapper .instagram-media img,
.instagram-post-wrapper .instagram-media video {
    width: 100% !important;
    height: auto !important;
    object-fit: cover !important;
    border-radius: 8px !important;
    max-height: 100% !important;
}

/* Style Instagram video elements specifically for reels */
.instagram-post-wrapper .instagram-media video {
    background-color: #000 !important;
    object-fit: contain !important; /* Better for vertical videos/reels */
}

/* Enhanced support for Instagram iframes (embedded content) */
.instagram-post-wrapper .instagram-media iframe {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    border-radius: 8px !important;
    background-color: transparent !important;
}

/* Ensure proper scaling for Instagram's internal content */
.instagram-post-wrapper .instagram-media > div {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Special handling for Instagram Reels */
.instagram-post-wrapper[data-content-type="reel"] .instagram-media::before {
    content: "Reel";
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    z-index: 10;
}


.instagram-loading,
.instagram-error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    background-color: var(--card-color);
    border-radius: 8px;
    margin: 20px 0;
}

/* Loading skeleton animation for better perceived performance */
.instagram-loading-skeleton {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
    margin: 20px 0;
}

.instagram-skeleton-post {
    aspect-ratio: 3 / 4;
    background: linear-gradient(90deg, var(--card-color) 25%, var(--hover-color) 50%, var(--card-color) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.instagram-skeleton-post::before {
    content: '';
    position: absolute;
    top: 16px;
    left: 16px;
    width: 40px;
    height: 40px;
    background-color: var(--hover-color);
    border-radius: 50%;
}

.instagram-skeleton-post::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 70px;
    width: 100px;
    height: 12px;
    background-color: var(--hover-color);
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Responsive skeleton */
@media (max-width: 768px) {
    .instagram-loading-skeleton {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .instagram-loading-skeleton {
        grid-template-columns: repeat(2, 1fr);
    }
}

.instagram-loading i,
.instagram-error i {
    display: block;
    margin: 0 auto 10px;
}

/* Spinning animation for loading icon */
.w3-spin {
    animation: w3-spin 2s infinite linear;
}

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

/* 2026-04-01: Custom Gallery Grid */
.custom-gallery-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    box-sizing: border-box;
}

.custom-gallery-item {
    flex: 0 1 auto;
    max-width: 350px;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.custom-gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.custom-gallery-item img {
    width: 100%;
    height: auto;
    display: block;
}

[data-theme="dark"] .custom-gallery-item {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .custom-gallery-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Responsive design for Instagram grid */
@media (max-width: 768px) {
    .instagram-posts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        justify-items: center;
    }

    .instagram-grid-container {
        padding: 0 8px;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    /* Maintain 4:5 aspect ratio on mobile */
    .instagram-post-wrapper {
        aspect-ratio: 3 / 4;
        width: 100%;
    }
    
    /* Custom Gallery mobile */
    .custom-gallery-grid {
        flex-direction: column;
        align-items: center;
        padding: 0 8px;
    }
    
    .custom-gallery-item {
        max-width: 100%;
    }
        max-width: 400px; /* Prevent posts from becoming too large on mobile */
        margin: 0 auto; /* Center the post */
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .instagram-posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }

    /* Maintain 4:5 aspect ratio on tablet */
    .instagram-post-wrapper {
        aspect-ratio: 3 / 4;
        width: 100%;
    }
}

/* Instagram fallback post styling */
.instagram-fallback-post {
    background-color: var(--card-color);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--secondary-text-color);
    transition: all 0.3s ease;
    /* 4:5 aspect ratio for fallback posts too */
    aspect-ratio: 3 / 4;
}

/* Fallback for browsers that don't support aspect-ratio */
@supports not (aspect-ratio: 3 / 4) {
    .instagram-fallback-post {
        height: 0;
        padding-bottom: 133.333%; /* 4/3 = 1.3333 = 133.333% for 3:4 aspect ratio */
        position: relative;
        padding-top: 20px;
        padding-left: 20px;
        padding-right: 20px;
    }

    .instagram-fallback-post > * {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: calc(100% - 40px);
    }
}

.instagram-fallback-post:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.instagram-fallback-post i {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--secondary-text-color);
}

.instagram-fallback-post p {
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.4;
}

.instagram-fallback-post .instagram-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: bold;
    margin-top: 12px;
    padding: 8px 16px;
    border: 1px solid var(--accent-color);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.instagram-fallback-post .instagram-link:hover {
    background-color: var(--accent-color);
    color: var(--background-color);
}


/* WhatsApp Form Image Upload Styles */
.whatsapp-image-upload-container {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.whatsapp-image-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.whatsapp-image-preview {
    width: 80px;
    height: 80px;
    border: 1px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: #f5f5f5;
}

.whatsapp-image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.whatsapp-image-preview .placeholder {
    color: #999;
    font-size: 12px;
    text-align: center;
}

.whatsapp-file-input-wrapper {
    flex-grow: 1;
}


/* 2026-03-18: Typed.js cursor styling */
.typed-cursor {
    font-weight: normal;
    color: var(--text-color);
    opacity: 1;
    animation: blink 0.7s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

#typed-output {
    min-height: 1.2em;
    display: inline-block;
}
