/* New file test */
@media (max-width: 767.98px) {
    .container,
    .container-fluid,
    .container-lg,
    .container-md,
    .container-sm,
    .container-xl,
    .container-xxl,
    .row { 
        --bs-gutter-x: 0rem; 
    }
}

.drag-drop-zone {
    position: relative;
    width: 100%;
}

.drag-drop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 123, 255, 0.1);
    border: 3px dashed #007bff;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    color: #007bff;
    pointer-events: none;
    z-index: 1000;
}

.drag-drop-overlay i {
    font-size: 3em;
    margin-bottom: 10px;
}

.drag-drop-zone.drag-over textarea {
    background-color: rgba(0, 123, 255, 0.05);
}

/* New styles for permanent drag-drop indicator */
.drag-drop-zone textarea {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" fill="rgba(0,123,255,0.1)" viewBox="0 0 16 16"><path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z"/><path d="M7.646 1.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 2.707V11.5a.5.5 0 0 1-1 0V2.707L5.354 4.854a.5.5 0 1 1-.708-.708l3-3z"/></svg>');
    background-repeat: no-repeat;
    background-position: center 30%;
    background-size: 50px;
    transition: background-color 0.3s ease;
}

.drag-drop-zone textarea:focus {
    background-image: none;
}

.drag-drop-zone.drag-over textarea {
    background-image: none;
}

.tagline-container {
  text-align: center;
  margin-top: -10px;
  margin-bottom: 80px;
}

.tagline {
  font-family: 'Arial', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background-image: linear-gradient(45deg, #00FF00, #4169E1, #8A2BE2);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  display: inline-block;
  position: relative;
  padding: 0 10px;
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0% {
    background-position: 0% center;
  }
  50% {
    background-position: 100% center;
  }
  100% {
    background-position: 0% center;
  }
}

.token-usage-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.token-stat {
    /* You can add padding here if needed e.g., padding: 0 0.25rem; */
}
        .token-divider {
            border-left: 1px solid #dee2e6; /* Standard Bootstrap border color */
            height: 1em;                   /* Adjust height to align well with text */
            margin-left: 0.75rem;
            margin-right: 0.75rem;
        }

        /* Skeleton loading styles for preventing CLS */
        .skeleton {
            background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
            background-size: 200% 100%;
            animation: skeleton-loading 1.5s infinite;
            border-radius: 4px;
        }

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

        .skeleton-category-button {
            height: 50px;
            width: 120px;
            margin: 10px;
            display: inline-block;
        }

        .skeleton-template-gallery {
            height: 200px;
            margin-bottom: 20px;
        }

        .skeleton-selected-template {
            width: 300px;
            height: 350px;
            margin: 0 auto;
        }

        .skeleton-title {
            height: 20px;
            width: 200px;
            margin: 10px auto;
        }

        /* Reserve space to prevent CLS */
        #categoryButtons {
            min-height: 70px; /* Height of a button row */
        }
        #selectedTemplateImage {
            min-height: 300px; /* Height of selected image */
        }

        #subscription-options {
            min-height: 550px; /* Approx height of pricing cards */
        }

        .hidden {
            display: none !important;
        }

/* Custom CSS for index.html */

/* Accordion Customizations */
.accordion-button {
    padding: 0.75rem 1rem; /* Reduced padding */
}

.accordion-body {
    padding: 0.75rem; /* Reduced padding */
}

/* Saved Documents List Customizations */
#document-list-container .list-group-item {
    padding: 0.5rem 0.75rem; /* Reduced padding */
}

#document-list-container .document-title h6 {
    font-size: 0.9rem; /* Smaller title font */
    margin-bottom: 0;
}

#document-list-container .text-muted {
    font-size: 0.75rem; /* Smaller date font */
}

#document-list-container .btn {
    padding: 0.15rem 0.4rem; /* Smaller buttons */
    font-size: 0.75rem; /* Smaller button font */
}

#document-list-container .btn i {
    font-size: 0.8rem; /* Smaller icons in buttons */
}

/* Custom gradient styling for document action buttons to match site theme */
#document-list-container .load-document-btn,
#document-list-container .share-document-btn,
#document-list-container .rename-document-btn {
    background: #4169E1;
    border: none;
    color: white;
    font-weight: bold;
}

#document-list-container .load-document-btn:hover,
#document-list-container .share-document-btn:hover,
#document-list-container .rename-document-btn:hover {
    background: #2c5aa0;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Green styling for loaded document button */
#document-list-container .load-document-btn.btn-success {
    background: #28a745 !important;
    border-color: #28a745 !important;
    color: white !important;
    font-weight: bold;
}

#document-list-container .load-document-btn.btn-success:hover {
    background: #218838 !important;
    border-color: #1e7e34 !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.image-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: min-content;
    align-items: start;
    gap: 1rem;
    height: 400px; /* Fixed height instead of max-height */
    overflow-y: auto;
    padding: 1rem;
    border: 1px solid #dee2e6;
    border-radius: .25rem;
}

.image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 Aspect Ratio */
    overflow: hidden;
    border-radius: .25rem;
}

.image-wrapper.hidden {
    display: none;
}

.image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .2s ease-in-out;
}

.image-wrapper img:hover {
    transform: scale(1.05);
}

.image-delete-icon {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 10;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.image-wrapper:hover .image-delete-icon {
    opacity: 1;
}

.image-select-checkbox {
    position: absolute;
    top: 5px;
    left: 5px;
    z-index: 10;
    width: 20px;
    height: 20px;
}

.image-wrapper input[type="checkbox"]:checked ~ img {
    border: 3px solid #0d6efd; /* A blue border to indicate selection */
    box-shadow: 0 0 10px rgba(13, 110, 253, 0.5);
}

/* Loading state that matches final content dimensions */
.image-library-loading {
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dee2e6;
    border-radius: .25rem;
    background-color: #f8f9fa;
}

/* Enhanced image styles for TinyMCE and PDF output */
.mce-content-body img,
.formatted-content img {
    max-width: 100%;
    height: auto;
}

/* Ensure image transformations work properly */
.mce-content-body img[style*="transform"],
.formatted-content img[style*="transform"] {
    display: inline-block;
    margin: 10px;
}

/* Make sure polaroid style images have proper spacing */
.mce-content-body img[style*="rotate"],
.formatted-content img[style*="rotate"] {
    margin: 20px;
}

/* Ensure shadow effects are visible in editor */
.mce-content-body img[style*="box-shadow"],
.formatted-content img[style*="box-shadow"] {
    margin: 15px;
}

/* Image Library List View Styles */
.image-gallery-list {
    display: flex;
    flex-direction: column;
    height: 400px; /* Fixed height instead of max-height */
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: .25rem;
}

.image-list-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid #e9ecef;
    background: #fff;
    transition: background-color 0.2s ease-in-out;
    position: relative;
}

.image-list-item:last-child {
    border-bottom: none;
}

.image-list-item:hover {
    background-color: #f8f9fa;
}

.image-list-item.hidden {
    display: none;
}

.image-list-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 0.375rem;
    margin-right: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease-in-out;
    flex-shrink: 0;
}

.image-list-thumbnail:hover {
    transform: scale(1.05);
}

.image-list-content {
    flex: 1;
    min-width: 0; /* Allows text truncation */
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.image-list-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.image-list-title:hover {
    background-color: #f8f9fa;
}

.image-list-title.editable {
    background-color: #e9ecef;
    border: 1px solid #adb5bd;
}

.image-list-title.no-title {
    color: #6c757d;
    font-style: italic;
    font-weight: normal;
}

.image-list-title.no-title:hover {
    color: #495057;
    background-color: #f8f9fa;
}

.image-title-input {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
    margin: 0;
    padding: 2px 4px;
    border: 2px solid #0d6efd;
    border-radius: 3px;
    background-color: #fff;
    width: 100%;
    outline: none;
}

.image-title-input:focus {
    border-color: #0a58ca;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.image-list-filename {
    font-size: 0.8rem;
    color: #6c757d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-list-date {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.image-list-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.image-list-checkbox {
    width: 18px;
    height: 18px;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.image-list-delete {
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0.7;
    transition: opacity 0.2s ease-in-out, background-color 0.2s ease-in-out;
}

.image-list-item:hover .image-list-delete {
    opacity: 1;
}

.image-list-delete:hover {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
}

/* View Controls Styles */
.image-view-controls .btn-group .btn {
    border-radius: 0.375rem;
}

.image-view-controls .btn-group .btn:first-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.image-view-controls .btn-group .btn:last-child {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.image-view-controls .btn.active {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: white;
}

/* Responsive Design for Mobile (avoiding Bootstrap) */
@media (max-width: 768px) {
    .image-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 0.5rem;
        padding: 0.75rem;
        height: 300px; /* Fixed height instead of max-height */
    }
    
    .image-wrapper {
        padding-top: 100%; /* Maintain 1:1 aspect ratio */
    }
    
    .image-delete-icon {
        width: 24px;
        height: 24px;
        top: 3px;
        right: 3px;
    }
    
    .image-select-checkbox {
        width: 16px;
        height: 16px;
        top: 3px;
        left: 3px;
    }
    
    /* List view mobile adjustments */
    .image-gallery-list {
        height: 300px; /* Fixed height instead of max-height */
    }
    
    .image-library-loading {
        height: 300px; /* Match mobile gallery heights */
    }
    
    .image-list-item {
        padding: 0.5rem;
    }
    
    .image-list-thumbnail {
        width: 50px;
        height: 50px;
        margin-right: 0.75rem;
    }
    
    .image-list-content {
        gap: 0.125rem;
    }
    
    .image-list-title {
        font-size: 0.85rem;
    }
    
    .image-list-filename {
        font-size: 0.75rem;
    }
    
    .image-list-date {
        font-size: 0.7rem;
    }
    
    .image-list-delete {
        width: 28px;
        height: 28px;
    }
    
    .image-list-checkbox {
        width: 16px;
        height: 16px;
        margin-right: 0.375rem;
    }
    
    /* View controls mobile adjustments */
    .image-view-controls {
        flex-wrap: wrap;
        gap: 0.5rem !important;
    }
    
    .image-view-controls .btn-group .btn {
        font-size: 0.8rem;
        padding: 0.375rem 0.5rem;
    }
    
    .image-view-controls .dropdown .btn {
        font-size: 0.8rem;
        padding: 0.375rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .image-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 0.375rem;
        padding: 0.5rem;
        height: 300px; /* Smaller height on mobile to fit screen better */
    }
    
    .image-gallery-list {
        height: 300px; /* Smaller height on mobile to fit screen better */
    }
    
    .image-library-loading {
        height: 300px; /* Match mobile gallery heights */
    }
    
    .image-list-thumbnail {
        width: 45px;
        height: 45px;
        margin-right: 0.5rem;
    }
    
    .image-list-item {
        padding: 0.375rem;
    }
    
    .image-list-title {
        font-size: 0.8rem;
    }
    
    .image-list-filename,
    .image-list-date {
        font-size: 0.7rem;
    }
}

/* TinyMCE Toolbar Customization */
/* Make the Image Library button green to draw attention */
.tox .tox-tbtn[aria-label*="Image Library"] svg,
.tox .tox-tbtn[title*="Image Library"] svg {
    fill: #28a745 !important; /* Bootstrap success green */
}

.tox .tox-tbtn[aria-label*="Image Library"]:hover svg,
.tox .tox-tbtn[title*="Image Library"]:hover svg {
    fill: #218838 !important; /* Darker green on hover */
}

/* Make the Image Styles button purple to distinguish it */
.tox .tox-tbtn[aria-label*="Image Styles"] svg,
.tox .tox-tbtn[title*="Image Styles"] svg {
    fill: #6f42c1 !important; /* Purple for styling */
}

.tox .tox-tbtn[aria-label*="Image Styles"]:hover svg,
.tox .tox-tbtn[title*="Image Styles"]:hover svg {
    fill: #5a32a3 !important; /* Darker purple on hover */
}

.tox .tox-tbtn[aria-label*="Image Library"],
.tox .tox-tbtn[title*="Image Library"] {
    position: relative;
}

/* Add a subtle glow effect to make it even more noticeable */
.tox .tox-tbtn[aria-label*="Image Library"]::after,
.tox .tox-tbtn[title*="Image Library"]::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(40, 167, 69, 0.3);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tox .tox-tbtn[aria-label*="Image Library"]:hover::after,
.tox .tox-tbtn[title*="Image Library"]:hover::after {
    opacity: 1;
}