/* ====================================
   MODAL STYLES - Support both .modal and .modal-overlay
   ==================================== */

/* Base styles for both modal types */
.modal,
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 3000;
    overflow-y: auto;
    padding: 20px;
}

/* Active state - visible and centered */
.modal.active,
.modal-overlay.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 650px;  /* ← Reduced from 900px */
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    margin: auto;
}

.modal-lg {
    max-width: 750px;  /* ← Reduced from 1000px */
}


/* COMPACT MODAL HEADER */
.modal-header {
    padding: 14px 18px;
    border-bottom: 2px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
    border-radius: 12px 12px 0 0;
}

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

.modal-close,
.modal-close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

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

/* COMPACT MODAL BODY */
.modal-body {
    padding: 16px 18px;
    max-height: calc(85vh - 120px);
    overflow-y: auto;
}

/* COMPACT MODAL FOOTER */
.modal-footer {
    padding: 10px 18px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background-color: #f9fafb;
    border-radius: 0 0 12px 12px;
    position: sticky;
    bottom: 0;
}

/* EVEN MORE COMPACT */
.modal .form-group,
.modal-overlay .form-group {
    margin-bottom: 8px; /* Changed from 10px */
}

.modal .form-group label,
.modal-overlay .form-group label {
    display: block;
    margin-bottom: 2px; /* Changed from 3px */
    font-weight: 500;
    color: #374151;
    font-size: 12px;
}

.modal .form-group input,
.modal .form-group select,
.modal .form-group textarea,
.modal-overlay .form-group input,
.modal-overlay .form-group select,
.modal-overlay .form-group textarea {
    width: 100%;
    padding: 6px 8px; /* Changed from 7px 9px */
    border: 1px solid #d1d5db;
    border-radius: 5px;
    font-size: 13px;
    transition: border-color 0.2s;
}

.modal .form-grid,
.modal-overlay .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px; /* Changed from 10px */
}

.modal-body {
    padding: 14px 16px; /* Changed from 16px 18px */
    max-height: calc(85vh - 120px);
    overflow-y: auto;
}

.modal-header {
    padding: 12px 16px; /* Changed from 14px 18px */
    border-bottom: 2px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
    border-radius: 12px 12px 0 0;
}

.modal-footer {
    padding: 8px 16px; /* Changed from 10px 18px */
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background-color: #f9fafb;
    border-radius: 0 0 12px 12px;
    position: sticky;
    bottom: 0;
}

.address-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px; /* Changed from 12px */
    margin-bottom: 8px; /* Changed from 10px */
}


.address-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

/* Equipment Table */
.equipment-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 12px;
}

.equipment-table th,
.equipment-table td {
    padding: 6px;
    border: 1px solid #e5e7eb;
    text-align: left;
}

.equipment-table th {
    background: #f3f4f6;
    font-weight: 600;
    color: #374151;
}

.equipment-table input,
.equipment-table select {
    width: 100%;
    padding: 5px 7px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
}

/* Setup Section */
.setup-section {
    background: #eff6ff;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 14px;
    border: 1px solid #bfdbfe;
}

.setup-section h3 {
    margin: 0 0 10px 0;
    color: #1e40af;
    font-size: 13px;
    font-weight: 600;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.table-responsive {
    overflow-x: auto;
}

/* Autocomplete Suggestions */
.eq-model-cell {
    position: relative;
}

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

.eq-suggestion {
    padding: 7px 10px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f3f4f6;
}

.eq-suggestion:hover {
    background: #eff6ff;
}

.eq-suggestion strong {
    color: #1f2937;
    font-size: 12px;
}

.eq-suggestion span {
    color: #6b7280;
    font-size: 11px;
}
