:root,
[data-bs-theme="light"] {
    --bs-primary:              #1D9E75;
    --bs-primary-rgb:          29, 158, 117;
    --bs-link-color:           #1D9E75;
    --bs-link-hover-color:     #0F6E56;
    --bs-navbar-active-color:  #1D9E75;  /* this is the one */
}

[data-bs-theme="dark"] {
    --bs-primary:              #5DCAA5;
    --bs-primary-rgb:          93, 202, 165;
    --bs-link-color:           #5DCAA5;
    --bs-link-hover-color:     #9FE1CB;
    --bs-navbar-active-color:  #5DCAA5;  /* and this */
}
.btn-primary {
    --bs-btn-bg:           #1D9E75;
    --bs-btn-border-color: #1D9E75;
    --bs-btn-hover-bg:     #0F6E56;
    --bs-btn-hover-border-color: #0F6E56;
    --bs-btn-active-bg:    #085041;
    --bs-btn-active-border-color: #085041;
}

.btn-outline-primary {
    --bs-btn-color:        #1D9E75;
    --bs-btn-border-color: #1D9E75;
    --bs-btn-hover-bg:     #1D9E75;
    --bs-btn-hover-color:  #fff;
    --bs-btn-active-bg:    #0F6E56;
}


/* Links */
a {
    color: #1D9E75;
}

a:hover {
    color: #0F6E56;
}

/* Bootstrap accordion active state (open FAQ item header) */
.accordion-button:not(.collapsed) {
    color: #0F6E56;
    background-color: #E1F5EE;
    box-shadow: inset 0 -1px 0 #9FE1CB;
}

.accordion-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(29, 158, 117, 0.25);
}

/* Active nav links */
.nav-link.active,
.nav-link:hover {
    color: #1D9E75 !important;
}

/* nav-pills active tab (palette tabs on color pages) */
.nav-pills .nav-link.active {
    background-color: #1D9E75;
    color: #fff;
}

/* Form controls focus ring */
.form-control:focus,
.form-select:focus {
    border-color: #5DCAA5;
    box-shadow: 0 0 0 0.25rem rgba(29, 158, 117, 0.25);
}

/* Form switch (Pantone toggle) */
.form-check-input:checked {
    background-color: #1D9E75;
    border-color: #1D9E75;
}


/* CORE STYLES
-------------------------------------------------- */
body {
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
    overflow-x: hidden;
}

.content {
    min-height: calc(100vh - 100px);
    padding-bottom: 100px;
}

/* FOOTER
-------------------------------------------------- */
.footer {
    background-color: #eaeaea;
    text-align: center;
    padding: 10px 0;
    width: 100%;
    position: relative;
    bottom: 0; 
}

body[data-bs-theme="dark"] .footer {
    background-color: #1e1e1e;
    color: white;
}

body[data-bs-theme="light"] .footer {
    background-color: #f8f9fa;
    color: black;
}

/* IMAGE STYLES
-------------------------------------------------- */
.analyzed-image {
    max-width: 100%;
    height: auto;
    max-height: 300px;
    margin-bottom: 20px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    object-fit: cover;
}

@media (min-width: 768px) {
    .analyzed-image {
        max-width: 50%;
    }
}

/* Content images */
.content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 5px;
}

/* COLOR BOX STYLES
-------------------------------------------------- */
.color-box, .converted-box {
    width: 75px;
    height: 75px;
    border-radius: 10px;
    display: block;
    margin-bottom: 5px;
    cursor: pointer;
    margin-left: auto;
    margin-right: auto;
}

.color-info, .converted-info {
    text-align: center;
    margin-bottom: 20px;
    padding: 0.5em;
    border-radius: 5px;
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.results-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
    border-radius: 5px;
    margin-top: 5px;
    justify-content: center;
}

.color-name {
    cursor: pointer;
    position: relative;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.color-name::after {
    font-size: 12px;
    color: #999;
    margin-left: 5px;
    opacity: 0.8;
    position: relative;
    cursor: pointer;
    top: -2px;
}

/* COLOR PREVIEW
-------------------------------------------------- */
.color-preview {
    position: relative;
    display: none;
    margin-top: 10px;
    padding: 5px;
    border: 1px solid #ccc;
    background-color: white;
    border-radius: 3px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    text-align: center;
}

.color-box-preview {
    width: 100px;
    height: 30px;
    margin: 0 auto 5px auto;
}

.color-preview p {
    margin: 0;
}

/* Copyable elements */
.copyable {
    cursor: pointer;
    transition: transform 0.1s ease-in-out;
    position: relative;
    display: inline-block;
}

.copyable.clicked {
    transform: scale(0.95);
    color: white;
    border-radius: 4px;
    white-space: nowrap;
}

.copy-message {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    animation: fadeInOut 2s forwards;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { opacity: 0; }
}

/* FORM ELEMENTS
-------------------------------------------------- */
.form-check-input-lg {
    width: 7rem;
    height: 1rem;
    transform: scale(1.5);
}

/* PALETTE STYLES
-------------------------------------------------- */
.palette-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    height: 300px;
}

.palette-color {
    flex-grow: 1;
    position: relative;
    transition: flex-grow 0.3s ease;
}

.palette-color:nth-child(1) { flex-grow: 3; }
.palette-color:nth-child(2) { flex-grow: 2.5; }
.palette-color:nth-child(3) { flex-grow: 2; }
.palette-color:nth-child(4) { flex-grow: 1.5; }
.palette-color:nth-child(5) { flex-grow: 1; }

.palette-container .separator {
    display: none;
}

.palette-container > div:last-child {
    margin-bottom: 0;
}

/* COLOR PALETTES
-------------------------------------------------- */
.color-name {
    position: absolute;
    bottom: 5px;
    left: 5px;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 12px;
    opacity: 1;
}

/* ANIMATIONS
-------------------------------------------------- */
.shaking-text {
    animation: tada 1.5s ease-in-out forwards;
    animation-iteration-count: infinite;
    animation-delay: 1s;
    font-weight: bold;
}

@keyframes tada {
    0% { transform: scale(1); }
    10%, 20% { transform: scale(0.9) rotate(-2deg); }
    30%, 50%, 70% { transform: scale(1.1) rotate(2deg); }
    40%, 60% { transform: scale(1.1) rotate(-2deg); }
    80% { transform: scale(1.1) rotate(2deg); }
    100% { transform: scale(1) rotate(0); }
}

/* MODAL STYLES
-------------------------------------------------- */
.modal-content {
    border-radius: 8px;
    padding: 20px;
    border: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

.modal-header {
    border-bottom: none;
    padding-bottom: 10px;
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--bs-body-color);
}

.modal-body {
    padding: 15px 20px;
    background-color: var(--bs-body-bg);
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    border-top: none;
    padding: 1rem 1.5rem;
    text-align: right;
    display: flex;
    justify-content: space-between;
}

.modal-footer .btn {
    border-radius: 5px;
    padding: 10px 15px;
    min-width: 100px;
}

#downloadModalPalettes {
    background-color: var(--bs-btn-bg);
    color: var(--bs-btn-color);
}

.modal-header .close {
    padding: 1rem;
    margin: -1rem -1rem -1rem auto;
    font-size: 1.5rem;
    line-height: 1;
    background: none;
    border: 0;
    appearance: none;
}

.modal-header .close:hover {
    color: #ff5252;
}

.modal-header .modal-title small {
    font-size: 0.8em;
    color: #6c757d;
}

.modal-header .color-box-preview {
    width: 20px;
    height: 20px;
    border: 1px solid #ddd;
    display: inline-block;
    vertical-align: middle;
    margin-left: 10px;
}

.modal-header .modal-title {
    font-size: 1.1rem;
    line-height: 1.5;
}

#modalColorCode {
    font-weight: bold;
}

/* Nav pills in modal */
.nav-pills .nav-link {
    padding: 5px 5px;
    margin: 0 2px;
    flex: 1;
}

/* DROPZONE
-------------------------------------------------- */
#dropzone {
    border: 2px dashed #1D9E75;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    background-color: #E1F5EE;
    color: var(--bs-body-color);
    transition: background-color 0.3s, border-color 0.3s;
    min-height: 200px;
}

[data-bs-theme="dark"] #dropzone {
    background-color: #04342C;
    border-color: #5DCAA5;
}

#dropzone:hover {
    background-color: #9FE1CB;
}

[data-bs-theme="dark"] #dropzone:hover {
    background-color: #085041;
}

#dropzone.bg-light {
    background-color: #9FE1CB;
}

#dropzone p {
    margin: 0;
    font-size: 16px;
    color: #0F6E56;
}

[data-bs-theme="dark"] #dropzone p {
    color: #9FE1CB;
}

/* TOGGLE BUTTON
-------------------------------------------------- */
.analogous-toggle {
    position: absolute;
    right: 10px;
    top: 10px;
    z-index: 20;
    display: flex;
    align-items: center;
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    padding: 3px 10px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    cursor: pointer;
    border: 1px solid var(--bs-border-color);
    font-size: 12px;
    transition: all 0.2s ease;
}

.analogous-toggle:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* SPLIT INDICATOR
-------------------------------------------------- */
.split-indicator {
    position: absolute;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: rgba(255,255,255,0.6);
    cursor: pointer;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
}

.split-indicator span {
    font-size: 10px;
    font-weight: bold;
    color: #333;
    background-color: white;
    padding: 0 5px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.split-indicator:hover {
    background-color: rgba(255,255,255,0.8);
}

/* AD STYLES
-------------------------------------------------- */
/* Common styles for all ad containers */
.container-fluid.text-center {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* Top small height ad */
.small-height-ad {
    position: relative;
    width: 100%;
    max-width: 728px;
    height: 90px;
    margin: 0 auto 1.5rem;
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.small-height-ad ins.adsbygoogle {
    display: block !important;
    width: 100% !important;
    height: 90px !important;
    min-height: 50px !important;
    max-height: 90px !important;
    margin: 0 auto;
    border-radius: 8px;
    background-color: var(--bs-body-bg);
}

/* General ad container */
.ad-container {
    width: 100%;
    max-width: 728px;
    margin: 1.5rem auto;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
    border-radius: 8px;
}

.ad-container-footer {
    min-height: 90px;
    margin-top: 2rem;
}

.ad-container ins.adsbygoogle {
    display: block !important;
    width: 100% !important;
    height: 90px !important;
    min-height: 50px !important;
    margin: 0 auto;
    border-radius: 8px;
    background-color: var(--bs-body-bg);
}

/* Right-side ad */
.ad-slot {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.ad-slot ins.adsbygoogle {
    display: block !important;
    width: 100% !important;
    height: 600px !important;
    overflow: hidden;
    border-radius: 5px;
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
}

/* In-article ads */
ins.adsbygoogle[data-ad-layout="in-article"] {
    display: block !important;
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* RESPONSIVE STYLES
-------------------------------------------------- */
@media (max-width: 992px) {
    .modal-lg {
        max-width: 700px;
    }
}

@media (max-width: 768px) {
    #dropzone {
        padding: 20px;
    }

    .modal-dialog {
        margin: 20px auto;
    }
    
    .modal-content,
    .modal-body {
        padding: 15px;
    }
    
    .modal-header, 
    .modal-footer {
        padding: 10px 15px;
    }

    .modal-title {
        font-size: 1.25rem;
    }

    .modal-footer .btn {
        width: 100%;
        margin-bottom: 5px;
    }

    /* Mobile ad styles */
    .ad-container-footer {
        min-height: 50px;
    }
    
    .ad-container ins.adsbygoogle,
    .small-height-ad,
    .small-height-ad ins.adsbygoogle {
        height: 50px !important;
        max-width: 100% !important;
    }

    .adsbygoogle {
        max-width: 320px;
    }

    /* Bottom ad sizing and positioning */
    .ad-container-footer {
        width: 100%;
        max-width: 320px;
        margin-left: auto;
        margin-right: auto;
        margin-top: 3.125rem;
    }
    
    .ad-container-footer ins.adsbygoogle {
        width: 100% !important;
        max-width: 320px !important;
        margin: 0 auto;
        display: inline-block !important;
    }

    /* Special handling for color names page */
    #mainContent .ad-container-footer {
        width: 100%;
        max-width: 320px;
        margin: 2rem auto;
        overflow-x: hidden;
        height: auto !important;
        min-height: 90px;
        padding: 0;
        text-align: center;
        display: flex;
        justify-content: center;
        align-items: center;
        box-sizing: border-box;
    }
    
    #mainContent .ad-container-footer ins.adsbygoogle {
        display: inline-block !important;
        margin: 0 auto;
        text-align: center;
        max-width: 100%;
    }
}

@media (max-width: 727px) {
    .small-height-ad {
        height: 50px;
        text-align: center;
    }
    
    .small-height-ad ins.adsbygoogle {
        height: 50px !important;
        aspect-ratio: 728/90;
        max-width: 100% !important;
        display: inline-block !important;
    }
}

@media (max-width: 576px) {
    .nav-pills {
        flex-wrap: wrap;
    }
    .nav-pills .nav-item {
        flex: 0 0 50%;
        max-width: 50%;
        margin-bottom: 5px;
    }
}

/* Prevent horizontal scrolling */
body, html, #mainContent {
    max-width: 100%;
    overflow-x: hidden;
}