/* Compact and Modern Modal Styling */

/* General modal improvements */
.modal-dialog {
    margin: 10px auto !important;
    max-width: 95% !important;
}

.modal-content {
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    border: none !important;
    max-height: 90vh !important;
    display: flex !important;
    flex-direction: column !important;
}

.modal-header {
    padding: 12px 20px !important;
    background: linear-gradient(135deg, #3c8dbc, #367fa9) !important;
    color: white !important;
    border-radius: 8px 8px 0 0 !important;
    border-bottom: none !important;
    flex-shrink: 0 !important;
}

.modal-header .modal-title {
    font-size: 16px !important;
    font-weight: 600 !important;
    margin: 0 !important;
}

.modal-header .close {
    color: white !important;
    opacity: 0.8 !important;
    font-size: 24px !important;
    text-shadow: none !important;
    margin-top: -2px !important;
}

.modal-header .close:hover {
    opacity: 1 !important;
}

/* Compact modal body */
.modal-body {
    padding: 15px 20px !important;
    max-height: 65vh !important;
    overflow-y: auto !important;
    flex: 1 !important;
}

/* Form group spacing */
.modal-body .form-group {
    margin-bottom: 12px !important;
}

.modal-body .box-body {
    padding: 0 !important;
}

/* Label styling */
.modal-body label {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #333 !important;
    margin-bottom: 4px !important;
    display: block !important;
}

/* Input styling */
.modal-body .form-control {
    height: 32px !important;
    padding: 4px 8px !important;
    font-size: 12px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    transition: all 0.2s ease !important;
}

.modal-body .form-control:focus {
    border-color: #3c8dbc !important;
    box-shadow: 0 0 0 2px rgba(60, 141, 188, 0.2) !important;
}

.modal-body textarea.form-control {
    height: 60px !important;
    resize: vertical !important;
}

/* Select2 adjustments */
.modal-body .select2-container .select2-selection--single {
    height: 32px !important;
    border: 1px solid #ddd !important;
}

.modal-body .select2-container .select2-selection--single .select2-selection__rendered {
    line-height: 30px !important;
    padding-left: 8px !important;
    font-size: 12px !important;
}

.modal-body .select2-container .select2-selection--single .select2-selection__arrow {
    height: 30px !important;
}

/* Column adjustments for smaller screens */
.modal-body .col-md-4 {
    padding-left: 10px !important;
    padding-right: 10px !important;
}

/* Row spacing */
.modal-body .row {
    margin-left: -10px !important;
    margin-right: -10px !important;
    margin-bottom: 8px !important;
}

/* HR styling */
.modal-body hr {
    margin: 15px 0 10px 0 !important;
    border-color: #eee !important;
}

/* Error message styling */
.text-danger {
    font-size: 10px !important;
}

/* Footer styling */
.modal-footer {
    padding: 12px 20px !important;
    background-color: #f8f9fa !important;
    border-top: 1px solid #eee !important;
    border-radius: 0 0 8px 8px !important;
    text-align: right !important;
    flex-shrink: 0 !important;
}

.modal-footer .btn {
    padding: 6px 16px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    border-radius: 4px !important;
    margin-left: 8px !important;
    min-width: 80px !important;
}

.modal-footer .btn-primary {
    background: linear-gradient(135deg, #3c8dbc, #367fa9) !important;
    border: none !important;
}

.modal-footer .btn-warning {
    background: #f39c12 !important;
    border: none !important;
    color: white !important;
}

/* Specific modal sizing */
#customer-modal .modal-dialog {
    max-width: 90% !important;
}

#item-modal .modal-dialog {
    max-width: 85% !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 5px auto !important;
        max-width: 98% !important;
    }
    
    .modal-content {
        max-height: 95vh !important;
    }
    
    .modal-body {
        max-height: 75vh !important;
        padding: 10px 15px !important;
    }
    
    .modal-body .col-md-4 {
        padding-left: 5px !important;
        padding-right: 5px !important;
    }
    
    .modal-body .row {
        margin-left: -5px !important;
        margin-right: -5px !important;
    }
    
    .modal-header {
        padding: 8px 15px !important;
    }
    
    .modal-footer {
        padding: 8px 15px !important;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .modal-body .col-md-4 {
        margin-bottom: 8px !important;
    }
    
    .modal-body .form-group {
        margin-bottom: 8px !important;
    }
    
    .modal-body hr {
        margin: 8px 0 5px 0 !important;
    }
}

/* Remove extra spacing from box-body containers */
.modal .box-body {
    padding: 0 !important;
    margin: 0 !important;
}

/* File input styling */
.modal-body input[type="file"] {
    height: auto !important;
    padding: 4px !important;
    font-size: 11px !important;
}

/* Image upload message */
.modal-body #item_image_msg {
    font-size: 9px !important;
    margin-top: 2px !important;
}

/* Hidden elements remain hidden */
.hide {
    display: none !important;
}

/* Popover adjustments for compact view */
.hover-q i {
    font-size: 11px !important;
    margin-left: 4px !important;
}

/* Compact scrollbar for modal body */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Modal backdrop for better focus */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.5) !important;
}

/* Ensure modals stay within viewport */
.modal {
    padding: 0 !important;
}

/* Compact form sections */
.modal-body .row + .row {
    margin-top: 5px !important;
}

/* Better spacing for required fields */
.modal-body .text-danger[class*="pull-right"] {
    position: absolute !important;
    right: 10px !important;
    top: 0 !important;
    font-size: 9px !important;
}

/* Position error messages better */
.modal-body .form-group {
    position: relative !important;
}

/* Improve visual hierarchy */
.modal-body .form-group label {
    position: relative !important;
    padding-right: 20px !important;
}
