* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.input-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.input-group {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.input-group label {
    font-weight: 600;
    color: #34495e;
}

.input-group input {
    flex: 1;
    min-width: 200px;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: #3498db;
}
.submit-btn.reset {
    background: #3214b9;
}
.submit-btn:disabled,
.submit-btn.disabled {
    opacity: 0.7 !important;
    cursor: not-allowed;
}

.submit-btn {
    background: #3498db;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.submit-btn:hover {
    background: #2980b9;
}

.tabs-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.tabs-container-body {
    margin-top: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.content-tab{
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* =================================
    TAB NAVIGATION STYLES
================================= */
.tabs {
    width: calc(100% - 120px);
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap; /* keep tabs on a single row */
    -webkit-overflow-scrolling: touch; /* smooth scroll on mobile */
}

.tabs-body {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.tab {
    flex: 0 0 auto; /* prevent shrinking and keep natural width */
    white-space: nowrap; /* avoid text wrapping inside tab */
    padding: 15px 20px;
    background: #f8f9fa;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.tab:hover {
    background: #e9ecef;
}

.tab.active {
    background: white;
    color: #3498db;
    border-bottom-color: #3498db;
}

.tab-body {
    flex: 1;
    padding: 15px 20px;
    background: #f8f9fa;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.tab-body:hover {
    background: #e9ecef;
}

.tab-body.active {
    background: white;
    color: #3498db;
    border-bottom-color: #3498db;
}

.tab-content {
    display: none;
    padding: 20px;
}

.tab-content.active {
    display: block;
}

.tab-content-body {
    display: none;
    padding: 20px;
}

.tab-content-body.active {
    display: block;
}

/* =================================
    LAYOUT COMPONENTS
================================= */
.footer {
    display: flex;
    justify-content: end;
    align-items: center;
    width: 100%;
    padding: 20px;
}

.editor-container {
    height: 400px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 15px;
}

/* =================================
    ACTION BUTTONS & CONTROLS
================================= */
.tab-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.action-btn {
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.validate-btn {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.validate-btn:hover {
    background: #218838;
}

.clear-btn {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.clear-btn:hover {
    background: #c82333;
}

.format-btn {
    background: #ffc107;
    color: #212529;
    border-color: #ffc107;
}

.format-btn:hover {
    background: #e0a800;
}

/* =================================
    STATUS MESSAGES
================================= */
.status {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
    font-size: 14px;
    display: none;
}

.status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* =================================
    GALLERY LAYOUT & GRID
================================= */
.card-edit-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    padding: 20px;
    min-height: 300px;
}

/* =================================
    IMAGE CARDS & DRAG/DROP
================================= */
.image-card {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    cursor: grab;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.image-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.image-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
    transform: rotate(5deg);
}

.image-card.drag-over {
    border-color: #3498db;
    background: #f8f9fa;
}

.card-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.card-content {
    padding: 12px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-position {
    background: #e9ecef;
    color: #6c757d;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.delete-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.3s;
}

.delete-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

.gallery-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 20px;
}

.add-image-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.add-image-btn:hover {
    background: #218838;
}

.gallery-limit-control {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #6c757d;
    font-size: 14px;
}

.gallery-limit-control label {
    font-weight: 500;
}

.gallery-info {
    color: #6c757d;
    font-size: 14px;
}

.drop-zone {
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    color: #6c757d;
    background: #f8f9fa;
    transition: all 0.3s;
}

.drop-zone.drag-over {
    border-color: #3498db;
    background: #e3f2fd;
    color: #1976d2;
}

.empty-gallery {
    grid-column: 1 / -1;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.modal-close:hover {
    background: #f8f9fa;
    color: #dc3545;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    width: 80vw;
    /* max-width: 500px; */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
    max-height: 80vh;
    overflow-y: scroll;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.close-btn:hover {
    background: #f8f9fa;
    color: #dc3545;
}

.upload-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #dee2e6;
}

.upload-tab {
    flex: 1;
    padding: 12px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.upload-tab.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

.upload-content {
    display: none;
}

.upload-content.active {
    display: block;
}

.file-upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.3s;
    cursor: pointer;
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: #3498db;
    background: #e3f2fd;
}

.file-upload-area input[type="file"] {
    display: none;
}

.upload-icon {
    font-size: 48px;
    color: #6c757d;
    margin-bottom: 15px;
}

.upload-text {
    color: #6c757d;
    margin-bottom: 10px;
}

.upload-hint {
    font-size: 12px;
    color: #adb5bd;
}

.url-input-group {
    margin-bottom: 20px;
}

.url-input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
}

.url-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.url-input:focus {
    outline: none;
    border-color: #3498db;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.modal-btn.cancel {
    background: #6c757d;
    color: white;
}

.modal-btn.cancel:hover {
    background: #5a6268;
}

.modal-btn.upload {
    background: #28a745;
    color: white;
}

.modal-btn.upload:hover {
    background: #218838;
}

.modal-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.loading-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* =================================
    PAGE HTML MODAL STYLES
================================= */
.page-html-form {
    padding: 0;
}

.page-html-form .input-group-modal {
    margin-bottom: 15px;
}

.page-html-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.page-html-form input[type="url"],
.page-html-form input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.page-html-form input[type="url"]:focus,
.page-html-form input[type="text"]:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

#pageHtmlEditor {
    border: 2px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

#pageHtmlEditor:focus-within {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.page-html-loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: #6c757d;
}

.page-html-loading.show {
    display: block;
}

.page-html-loading .spinner {
    margin: 0 auto 15px;
}

.customer-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.customer-dropdown-item {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
}

.customer-dropdown-item:hover {
    background-color: #f8f9fa;
}

.customer-dropdown-item:last-child {
    border-bottom: none;
}

.customer-dropdown-item.selected {
    background-color: #007bff;
    color: white;
}

.customer-dropdown-item.selected:hover {
    background-color: #0056b3;
}

.customer-name {
    font-weight: 400;
    font-size: 14px;
}

.customer-id-input:focus+.customer-dropdown {
    border-color: #667eea;
}

/* Dynamic Tab Controls CSS */
.tab-container {
    position: relative;
    display: flex;
    align-items: center;
    flex: 0 0 auto; /* size to content for horizontal scroll */
    width: auto;
}

.tab-container .tab {
    flex: 0 0 auto;
    margin: 0;
    border-radius: 0;
    line-clamp: 1;
}

.tab-controls {
    display: flex;
    gap: 5px;
    padding: 0 10px;
    background: inherit;
}

.tab-control-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
    font-size: 12px;
    transition: background-color 0.3s;
}

.tab-control-btn.add-btn:hover {
    background-color: #0bd8f3;
}

.tab-control-btn.edit-btn:hover {
    background-color: #e9ecef;
}

.tab-control-btn.delete-btn:hover {
    background-color: #f8d7da;
}

/* Add Tab Button Styles */
.add-tab-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    width: 100px;
    height: 50px;
    position: relative;
    overflow: hidden;
    margin-top: 10px;
    margin-right: 10px;
}

.add-tab-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.add-tab-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.add-tab-btn .add-icon {
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
}

.add-tab-btn .add-text {
    font-size: 13px;
    letter-spacing: 0.5px;
}

/* Add Tab Button Animation */
.add-tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.add-tab-btn:hover::before {
    left: 100%;
}

/* Add Category Modal Styles */
.category-preview {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.preview-tab {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Input Focus Effects for Add Category */
#newCategoryName:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

/* Responsive Design for Add Tab Button */
@media (max-width: 768px) {
    .add-tab-btn {
        padding: 8px 12px;
        font-size: 12px;
        margin-left: 5px;
    }
    
    .add-tab-btn .add-text {
        display: none;
    }
    
    .add-tab-btn .add-icon {
        font-size: 16px;
    }
}