/* =========================================
   DYNAMIC E-COMMERCE MODAL STYLES
   ========================================= */

.dynamic-modal-overlay {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(74, 42, 20, 0.85); /* Dark brown overlay */
    backdrop-filter: blur(5px);
    overflow-y: auto;
    padding: 20px;
}

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

.dynamic-modal-content {
    position: relative;
    background: #FFFFFF;
    width: 100%;
    max-width: 600px;
    border-radius: 24px;
    padding: 25px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
    font-family: 'Mitr', sans-serif;
    margin: 20px auto;
    color: #4A2A14;
    animation: modalSlideUp 0.3s ease-out forwards;
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Controls */
.modal-controls {
    position: absolute;
    top: -15px;
    right: -10px;
    display: flex;
    gap: 8px;
    z-index: 100;
}
.modal-close-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #FF0000;
    color: white;
    border: 3px solid #FFF;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}
.modal-close-btn:hover {
    transform: scale(1.1);
}

/* Header: 2 Columns */
.modal-header {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
}
.modal-img-wrap {
    width: 140px;
    height: 140px;
    border-radius: 16px;
    background: #f5f5f5;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}
.modal-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.modal-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #FF5C00;
    color: white;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
}
.modal-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.modal-title {
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 5px;
}
.modal-desc {
    font-size: 0.85rem;
    color: #8C6F5A;
    margin-bottom: 15px;
    line-height: 1.4;
}
.modal-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #FF5C00;
}
.modal-price span {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

/* Sections */
.modal-section {
    margin-bottom: 25px;
}
.modal-section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Material Selection (4-column grid) */
.material-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
@media(min-width: 500px) {
    .material-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
.mat-card {
    border: 2px solid #EAEAEA;
    border-radius: 12px;
    padding: 10px 5px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.mat-card.active {
    border-color: #FF5C00;
    background: rgba(255,92,0,0.05);
}
.mat-label {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 3px;
    line-height: 1.2;
}
.mat-desc {
    font-size: 0.65rem;
    color: #888;
}

/* Size Selection */
.size-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #EAEAEA;
    border-radius: 10px;
    font-family: 'Mitr', sans-serif;
    font-size: 0.95rem;
    color: #4A2A14;
    outline: none;
    transition: border-color 0.2s;
}
.size-select:focus {
    border-color: #FFCB1B;
}

/* Form Inputs */
.modal-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #EAEAEA;
    border-radius: 10px;
    font-family: 'Mitr', sans-serif;
    font-size: 0.95rem;
    outline: none;
    resize: vertical;
    transition: border-color 0.2s;
}
.modal-input:focus {
    border-color: #FFCB1B;
}

/* Qty and Add to Cart */
.modal-footer {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #EAEAEA;
}
.qty-control {
    display: flex;
    align-items: center;
    border: 2px solid #EAEAEA;
    border-radius: 30px;
    overflow: hidden;
    height: 48px;
}
.qty-btn {
    width: 40px;
    height: 100%;
    background: #f9f9f9;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
}
.qty-btn:hover {
    background: #EAEAEA;
}
.qty-input {
    width: 50px;
    text-align: center;
    border: none;
    font-family: 'Mitr', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    outline: none;
    background: transparent;
}
.add-cart-btn {
    flex: 1;
    height: 48px;
    background: var(--brand-orange, #FF5C00);
    color: white;
    border: none;
    border-radius: 30px;
    font-family: 'Mitr', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.add-cart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255,92,0,0.3);
}
.add-cart-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* File Upload */
.file-upload-wrap {
    border: 2px dashed #ccc;
    padding: 20px;
    text-align: center;
    border-radius: 12px;
    background: #fafafa;
    cursor: pointer;
    transition: border-color 0.2s;
}
.file-upload-wrap:hover {
    border-color: #FF5C00;
}
.file-upload-wrap input {
    display: none;
}
.file-upload-text {
    font-size: 0.9rem;
    color: #666;
    margin-top: 8px;
}

/* Validation Message */
.val-msg {
    color: #FF0000;
    font-size: 0.8rem;
    margin-top: 5px;
    display: none;
}
