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

body {
    font-family: 'Arial', Arial, Helvetica, sans-serif;
    background: #f5f7fa;
    height: 100vh;
    overflow: hidden;
    background: #000000;
    background: -webkit-linear-gradient(0deg, rgba(0, 0, 0, 1) 0%, rgba(17, 17, 59, 1) 50%, rgba(12, 37, 61, 1) 100%);
    background: -moz-linear-gradient(0deg, rgba(0, 0, 0, 1) 0%, rgba(17, 17, 59, 1) 50%, rgba(12, 37, 61, 1) 100%);
    background: linear-gradient(0deg, rgba(0, 0, 0, 1) 0%, rgba(17, 17, 59, 1) 50%, rgba(12, 37, 61, 1) 100%);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#000000", endColorstr="#0C253D", GradientType=0);
}

.builder-container {
    display: grid;
    grid-template-columns: 240px 1fr 380px;
    height: 100vh;
    overflow: hidden;
}

/* SIDEBAR ENHANCED */
.sidebar {
    margin-top: 1rem;
    color: white;
    overflow-y: auto;
}

.sidebar-tabs {
    display: flex;
    /* From https://css.glass */
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.sidebar-tab {
    flex: 1;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    font-size: 1rem;
    transition: all 0.3s;
}

.sidebar-tab.active {

    /* From https://css.glass */
    background: rgba(0, 0, 0, 0.73);
    border-radius: 6px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
    border: 1px solid rgba(0, 0, 0, 0.47);
}

.sidebar-tab:hover {
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#000000", endColorstr="#0C253D", GradientType=0);
}

.sidebar-content {
    padding: 1rem;
}

.tab-panel {
    display: none;
}

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

/* Components styles (existing) */
.component-category {
    margin-bottom: 25px;
}

.component-category h3 {
    color: #b0233d;
    font-size: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgb(64, 17, 34);
}

.component-item {
    /* From https://css.glass */
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.component-item:hover {
    /* From https://css.glass */
    background: rgba(0, 0, 0, 0.73);
    border-radius: 6px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
    border: 1px solid rgba(0, 0, 0, 0.47);
    transform: translateY(-1px);
}

.component-item .icon {
    font-size: 16px;
}

/* Media Browser */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    margin-top: 15px;
}

.media-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.media-item:hover {
    border-color: #3498db;
    transform: scale(1.05);
}

.media-item.selected {
    border-color: #b0233d;
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.3);
}

.media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-item-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    padding: 2px 4px;
}

.media-upload {
    border: 2px dashed rgb(64, 17, 34);
    border-radius: 6px;
    padding: 20px;
    text-align: center;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.media-upload:hover {
    border-color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

/* Button Generator Tool */
.tool-button {
    /* From https://css.glass */
    background: rgba(255, 255, 255, 0.23);
    border-radius: 6px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
    border: 1px solid rgba(255, 255, 255, 0.45);
    color: white;
    border: none;
    padding: 12px 15px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 15px;
    font-size: 12px;
    transition: background 0.2s;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-button:hover {
    background: #a6094a;
}

/* 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);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    height: 85%;
    display: flex;
    flex-direction: column;
    /* box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); */
}

.modal-header {
    /* From https://css.glass */
    background: rgba(255, 255, 255, 0.23);
    border-radius: 6px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
    border: 1px solid rgba(255, 255, 255, 0.45);
    color: white;
    padding: 1rem;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Button Generator Styles */
.generator-container {
    display: flex;
    height: 100%;
    overflow: hidden;
}

.generator-controls {
    width: 350px;
    padding: 20px;
    background: #f8f9fa;
    overflow-y: auto;
}

.generator-preview {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.control-group input,
.control-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.bd-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.color-btn {
    width: 30px;
    height: 30px;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.color-btn.selected {
    border-color: #333;
    box-shadow: 0 0 0 2px #007bff;
    transform: scale(1.1);
}

/* Existing styles continue... */
.builder-area {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.builder-header {
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.builder-header h1 {
    font-size: 20px;
}

.actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    /* From https://css.glass */
    background: rgba(255, 255, 255, 0.23);
    border-radius: 6px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
    border: 1px solid rgba(255, 255, 255, 0.45);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.action-btn:hover {
    background: #a93226;
}

.canvas {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    /* background: #ecf0f1; */
    min-height: 0;
}

.drop-zone {
    min-height: 500px;
    border: 2px dashed #bdc3c7;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.23);
    border-radius: 6px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
    border: 1px solid rgba(255, 255, 255, 0.45);
    color: white;
    font-size: 16px;
    text-align: center;
}

.canvas-item {
    background: white;
    margin-bottom: 2px;
    border-radius: 0px;
    position: relative;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.canvas-item:hover {
    border-color: #3498db;
}

.canvas-item.selected {
    border-color: #cf0d4a;

}

.canvas-item .item-controls {
    position: absolute;
    top: -35px;
    right: 0;
    /* From https://css.glass */
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 5px;
    display: none;
    z-index: 100;
}

.canvas-item:hover .item-controls {
    display: block;
}

.control-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 2px 4px;
    margin: 0 1px;
    border-radius: 2px;
}

.control-btn:hover {
    background: #5d6d7e;
}

/* Properties Panel */
.properties-panel {
    background: #ecf0f1;
    padding: .5rem;
    overflow-y: auto;
    border-left: 0px solid #bdc3c7;
}

.properties-panel h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.property-group {
    margin-bottom: 15px;
}

.property-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #34495e;
}

.property-group input,
.property-group select,
.property-group textarea {
    width: 100%;
    padding: .5rem;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 12px;
}

/* BD Color Palette Styles */
.bd-color-picker {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    background: #f8f9fa;
}

.color-input-wrapper {
    margin-bottom: 10px;
}

.color-category {
    margin-bottom: 15px;
}

.color-category:last-child {
    margin-bottom: 0;
}

.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.color-swatch {
    position: relative;
    transition: all 0.2s ease;
}

.color-swatch:hover {
    transform: scale(1.1);
    z-index: 10;
}

.color-swatch.selected {
    transform: scale(1.1);
    z-index: 10;
}

/* Template buttons */
.template-btn {
    /* From https://css.glass */
    background: rgba(255, 255, 255, 0.23);
    border-radius: 6px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
    border: 1px solid rgba(255, 255, 255, 0.45);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    margin: 5px 5px 5px 0;
    font-size: 12px;
    transition: background 0.2s;
}

.template-btn:hover {
    background: #a6094a;
}

/* Modal Body Styles */
.modal-body {
    flex: 1;
    display: flex;
    gap: 20px;
    padding: 20px;
    overflow: hidden;
}

.preview-section {
    flex: 3;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.preview-section h3 {
    margin: 0 0 15px 0;
    color: #0e182b;
    font-size: 14px;
}

.preview-iframe {
    flex: 1;
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    min-height: 400px;
}

.html-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.html-section h3 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 16px;
}

.html-code {
    flex: 1;
    background: #2d3748;
    color: #e2e8f0;
    padding: 15px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.4;
    overflow: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.modal-footer {
    background: #f8f9fa;
    padding: 15px 20px;
    border-top: 1px solid #dee2e6;
    border-radius: 0 0 8px 8px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

/* Responsive adjustments for the preview modal */
@media (max-width: 1200px) {
    .modal-body {
        flex-direction: column;
    }

    .preview-section,
    .html-section {
        flex: none;
        height: 300px;
    }
}

/* Extracted inline styles */
.hidden-file-input {
    display: none;
}

.media-warning-message {
    margin-top: 20px;
    padding: 15px;
    background: #b0233d;
    border-radius: 6px;
    font-size: 12px;
}

.placeholder-text {
    color: #7f8c8d;
    font-style: italic;
}

.input-small-width {
    width: 100px;
}

.helper-text {
    color: #666;
    font-size: 11px;
    display: block;
    margin-top: 3px;
}

.button-group-container {
    margin-top: 20px;
}

.tool-button-teal {
    background: #16a085;
}

.tool-button-teal:hover {
    background: #138871;
}

.tool-button-green {
    background: #27ae60;
}

.tool-button-green:hover {
    background: #229954;
}

.tool-button-purple {
    background: #8e44ad;
}

.tool-button-purple:hover {
    background: #7d3c98;
}

.button-preview-canvas {
    border: 1px solid #ddd;
    margin: 20px 0;
}

.html-output-container {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    max-width: 400px;
}

.html-code-preview {
    font-size: 11px;
    background: #2d3748;
    color: #e2e8f0;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
}