:root {
    --primary-color: #DC7215;
    --secondary-color: #DC7215;
    --accent-color: #DC7215;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --text-color: #333333;
    --text-light: #6c757d;
    --background-color: #FFFFFF;
    --card-bg: #FFFFFF;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;

    --digishop-font:           Livvic;
    --digishop-font-size:      19px;
    --digishop-heading-font:   Bricolage Grotesque;
    --digishop-radius:         30px;
    --digishop-text-transform: uppercase;
    --digishop-img-height:     auto;
}

[data-theme="dark"] {
    --primary-color: #DC7215;
    --secondary-color: #DC7215;
    --accent-color: #DC7215;
    --light-color: #212529;
    --dark-color: #f8f9fa;
    --text-color: #F8F9FA;
    --text-light: #adb5bd;
    --background-color: #121212;
    --card-bg: #1E1E1E;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

h1, h2, h3, h4, p, form, input, label, i {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--digishop-font);
    background: var(--background-color);
    color: var(--text-color);
    transition: var(--transition);
    line-height: 1.3;
}

.digimart-cont { width: 100%; margin: 0 auto; padding: 20px 5px; box-sizing: border-box; }
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--secondary-color);
    transition: var(--transition);
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: var(--transition);
}

input:checked + .slider { background-color: var(--accent-color); }
input:checked + .slider:before { transform: translateX(30px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

.filter-btn {
    padding: 8px 16px;
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 2px solid var(--text-light);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    outline: none;
    transform: translateZ(0);
    backface-visibility: hidden;
    font-family: var(--digishop-font);
    font-weight: 600;
}

.filter-btn:hover { background-color: var(--primary-color); color: white; border-color: var(--primary-color); }
.filter-btn.active { background-color: var(--primary-color); color: white; border-color: var(--primary-color); }

.gallery-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
}

.gallery-toolbar .search-container {
    width: 280px;
    flex-shrink: 0; 
    display: flex;
    align-items: center;
    flex-shrink: 0;
    background-color: var(--card-bg);
    border: 2px solid transparent;
    border-radius: 30px; 
    padding: 2px 4px; 
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: var(--transition);
}
.gallery-toolbar .search-container:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(72, 149, 239, 0.2);
    transform: translateY(-1px);
}
.gallery-toolbar .search-container input {
    width: 100%;
    padding: 10px 9px;
    border: none;
    border-radius: 25px 0 0 25px;
    flex-grow: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-color);
    font-size: 0.95rem;
    font-family: inherit;
}
.gallery-toolbar .search-container input::placeholder {
    color: var(--text-light);
    opacity: 0.7;
}
.gallery-toolbar .search-container button {
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 5px;
    margin-left: 10px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.gallery-toolbar .search-container button:hover {
    color: var(--accent-color);
    transform: scale(1.15);
}

.gallery-toolbar .filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 0;
    flex: 1;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    background-color: var(--card-bg);
}
.gallery-item:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2); }
.gallery-img { width: 100%; height: 200px; object-fit: cover; display: block; transition: var(--transition); }
.gallery-item:hover .gallery-img { transform: scale(1.05); }

.image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    color: white;
    transform: translateY(100%);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.digimart-gallery .image-overlay {
  top: 0;
  z-index: 1;
  padding: 5px;
  align-items: flex-end;
}

.overlay-top { padding: 15px; width: 100%; }
.overlay-bottom {
    padding: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
}
.gallery-item:hover .image-overlay { transform: translateY(0); }
.image-title { font-size: 1rem; margin-bottom: 5px; }
.overlay-top h3.image-title {
  text-align: right;
  color: white;
  display: flex;
  justify-content: flex-end;
}
.image-category {
    font-size: 0.8rem;
    background-color: var(--primary-color);
    padding: 3px 8px;
    border-radius: 10px;
    display: inline-block;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-light);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.modal {
    display: none;
    position: fixed;
    z-index: 200;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    overflow: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: block;
    opacity: 1;
}

.modal-content {
    display: flex;
    flex-direction: column;
    background-color: var(--card-bg);
    margin: 4%;
    max-width: 100%;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    height: 94vh;
}

.close-btn {
    position: absolute;
    bottom: 10px;
    left: 15px;
    color: white;
    font-size: 45px;
    font-weight: normal;
    cursor: pointer;
    transition: var(--transition);
}

.close-btn:hover { color: var(--accent-color); }

#modal-image {
    width: 100%;
    max-height: 89vh;
    object-fit: contain;
    background-color: #000;
}

.image-info {
    padding: 20px;
    color: var(--text-color);
}

.image-info h2 {
    margin-bottom: 5px;
    line-height: 1;
    font-family: var(--digishop-heading-font);
    color: var(--text-color);
    font-size: 1.5rem;
}

.image-meta {
    display: flex;
    gap: 15px;
    margin: 4px 0 19px 0;
    color: var(--text-light);
    font-size: 0.9rem;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 7px;
}

.action-buttons button {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
}

#download-btn, #demo-btn { background-color: var(--primary-color); color: white; font-weight: 600; font-family: var(--digishop-font); }
#download-btn:hover, #demo-btn:hover { background-color: var(--secondary-color); }
#like-btn { background-color: transparent; border: 1px solid var(--text-light); color: var(--text-color); font-family: var(--digishop-font);}
#like-btn:hover { background-color: rgba(255, 0, 0, 0.1); border-color: red; color: red; }
#like-btn.liked { background-color: rgba(255, 0, 0, 0.1); border-color: red; color: red; }
#share-btn { background-color: transparent; border: 1px solid var(--text-light); color: var(--text-color); }
#share-btn:hover { background-color: rgba(0, 123, 255, 0.1); border-color: #075cb8; color: #075cb8; }

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    font-size: 1rem;
    font-family: var(--digishop-font);
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    z-index: 300;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.toast.show { opacity: 1; }

.product-form { flex: 1; margin: 0; }

.digimartbtn, .preview-btn {
    width: 100%;
    transition: var(--transition);
    padding: 10px 14px;
    border: none;
    border-radius: var(--digishop-radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    font-family: var(--digishop-font);
}

.digimartbtn { background-color: var(--primary-color); color: white; }
.digimartbtn:hover { background-color: var(--secondary-color); transform: translateY(-2px); }
.preview-btn { background-color: var(--light-color); color: var(--dark-color); flex: 0.8; width: fit-content; }
.preview-btn:hover { transform: translateY(-2px); }

.image-info {
    overflow-y: auto; /* Enables scrolling for the description/info side */
    max-height: 100%; 
}

#image-description {
    margin-bottom: 15px;
    max-height: fit-content;
    overflow-y: auto;
    padding-right: 10px;
}

.modal-image-container {
    width: 100%;
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1px;
    gap: 15px;
}
.info-header #image-price.price-badge {
  padding: 3px 10px;
  font-size: 0.9rem;
  font-family: Segoe UI;
  border-radius: 5px;
}
.price-badge {
    background-color: var(--accent-color);
    color: white;
    padding: 6px 12px;
    border-radius: var(--digishop-radius);
    font-size: 1.1rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
#image-price.price-badge {
    font-size: 1.8rem;
    padding: 0;
    font-family: Segoe UI;
}

/* Scrollable Description */
.image-info {
    display: flex;
    flex-direction: column;
}

.description-container {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 20px;
    padding-right: 4px;
    font-size: var(--digishop-font-size);
    scrollbar-width: thin;
    scrollbar-color: var(--text-light) rgba(0, 0, 0, 0.05);
}

/* Custom Scrollbar for Modal (Webkit) */
.description-container::-webkit-scrollbar {
    width: 6px;
}

.description-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}
.description-container::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: 4px;
}

/* --- MEDIA QUERIES --- */
@media (min-width: 768px) {
    .modal-image-container { width: 45%; position: relative; padding: 6px; }
    .md-backdrop { 
        background-size: cover; 
        width: 100%;
        height: 100%;
        position: absolute;
        z-index: 1;
        filter: blur(2px);
        opacity: 0.5;
        top: 0;
        left: 0;
    }
    .image-info { width: 55%; max-height: 94vh; }
    .description-container { max-height: 600px; }
    .modal-content { flex-direction: row; max-height: 80vh; }
    #modal-image { 
        width: 100%; 
        max-height: 80vh; 
        object-fit: cover; 
        height: auto;
        z-index: 5;
        border-radius: 15px; 
    }
    .image-info h2 { font-size: 2rem; }
}

@media (max-width: 600px) {
    .container { flex-direction: column; align-items: stretch; }   
    .gallery { grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); }
}
@media (max-width: 380px) {
    .container { flex-direction: column; align-items: center; display: flex;justify-content: center;box-sizing: border-box;}   
    .gallery { grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); }
}
@media (max-width: 360px) {
    .container { flex-direction: column; align-items: center; display: flex;justify-content: center;box-sizing: border-box;}   
    .gallery { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
    .overlay-bottom { flex-direction: row !important; padding: 0 1px 15px 1px !important; }
}
@media (max-width: 767px) {
    .info-header { flex-direction: row; gap: 10px; }
    .overlay-bottom { flex-direction: column; }
    #modal-image { height: 200px; object-fit: cover; }
    .image-meta { margin: 8px 0; }
    .modal-content { max-height: 90vh; }
    .gallery-toolbar { flex-wrap: wrap; align-items: flex-start; gap: 15px; }
    .gallery-toolbar .filter-controls { width: 100%; overflow-x: auto; flex-wrap: wrap; padding-bottom: 5px; flex: none; }
    .gallery-toolbar .filter-controls::-webkit-scrollbar { display: none; }
    .gallery-toolbar .search-container { width: 70%; }
    .gallery-toolbar .theme-toggle { width: auto; justify-content: flex-end; padding-top: 5px; }
}

@media (max-width: 580px) {
    .info-header { flex-direction: column; gap: 5px; }
    .action-buttons button { padding: 10px 7px; }
}

.digimart-gallery {
  font-family: var(--digishop-font);
  float: left;
  width: 100%;
  color: #ffffff;
  text-align: right;
  font-size: 16px;
}

/* Skewed Background Overlay */
.digimart-gallery:after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -30%;
  right: 70%;
  content: "";
  background-color: rgba(0, 0, 0, 0.733);
  transform: skew(20deg) translateX(-75%);
  transition: all 0.35s ease;
}

.digimart-gallery * { transition: all 0.35s ease; }

.digimart-gallery img {
  max-width: 100%;
  height: var(--digishop-img-height);
  object-fit: cover;
  display: block;
}

.digimart-gallery .overlay-top h3,
.digimart-gallery .overlay-bottom form,
.digimart-gallery .overlay-bottom .preview-btn {
  transform: translateX(40px);
  opacity: 0;
  margin: 0;
}

.digimart-gallery .overlay-bottom { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.digimart-gallery:hover:after { transform: skew(20deg) translateX(0%); }
.digimart-gallery:hover img { opacity: 0.5; }
.digimart-gallery:hover .overlay-top h3,
.digimart-gallery:hover .overlay-bottom form,
.digimart-gallery:hover .overlay-bottom .preview-btn {
  opacity: 1;
  transform: translateX(0px);
}
.digimart-gallery:hover .overlay-top .image-title { transition-delay: 0.1s; }
.digimart-gallery:hover .overlay-top .price-badge { transition-delay: 0.2s; }
.digimart-gallery:hover .overlay-bottom form { transition-delay: 0.3s; }
.digimart-gallery:hover .overlay-bottom .preview-btn { transition-delay: 0.4s; }
.digimart-gallery .top-left-info {
  position: absolute;
  top: 15px;
  left: 15px;
  z-index: 2; 
  display: flex;
  flex-direction: column;
  align-items: flex-start; 
  gap: 5px; 
  transition: all 0.35s ease;
}
.digimart-gallery .category-container { display: flex; flex-wrap: wrap; gap: 5px; }

.digimart-gallery .category-badge {
  background-color: #111827;
  color: #ffffff;
  padding: 6px 8px 5px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 5px;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 0;
}

.digimart-gallery .top-title {
  font-family: var(--digishop-heading-font);
  font-size: 1.3rem;
  font-weight: 800;
  margin: 0;
  text-transform: capitalize;
  text-align: left;
  line-height: 1.1;
}
.top-left-info h4.top-title {   
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.1);
    padding: 8px;
    font-size: 1.2rem;
    color: #111827;
    font-style: normal;
}
.heading-container {
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(4px);
   -webkit-backdrop-filter: blur(4px);
  margin-right: 15px;
  border-radius: 8px;
}
.digimart-gallery .top-price {
  color: #111827;
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  font-family: Segoe UI;
  background: var(--accent-color);
  padding: 2px 7px;
  border-radius: 4px;
}

.digimart-gallery:hover .top-left-info {
  opacity: 0;
  transform: translateY(-10px); 
  pointer-events: none;
}

/* --- Editor Settings --- */
#image-description font br {
    display: flex;
    margin-bottom: 4px;
    padding: 0;
}
#image-description > font
 {
    line-height: 1.1;
    font-family: var(--digishop-font);
    margin: 0;
    padding: 0;
}
[data-theme="dark"] #image-description > font {
    color: var(--text-color) !important;
}