/* Repair Request Form Styles */
/* Supports both modal and inline form display */

/* ========================================
   INLINE FORM CONTAINER STYLES
   ======================================== */

.imi-repair-form-container {
    max-width: 800px;
    margin: 30px auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.imi-repair-form-title {
    font-size: 24px;
    font-weight: 600;
    color: #199ca0;
    margin: 0 0 10px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid #199ca0;
}

.imi-repair-form-intro {
    font-size: 14px;
    color: #666;
    margin-bottom: 25px;
    line-height: 1.6;
}

.imi-form-actions {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: center;
}

.imi-btn-large {
    padding: 12px 40px;
    font-size: 16px;
}


/* Ensure inline form uses same field styles */
.imi-repair-form-container .imi-form-section {
    margin-bottom: 25px;
}

.imi-repair-form-container .imi-form-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #199ca0;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

/* Repair Request link highlight (matches brand teal even when visited) */
a.repair-request-link,
a.repair-request-link:visited {
    font-weight: 600;
    color: #199ca0;
    text-decoration-thickness: 2px;
    text-decoration-color: #199ca0;
    text-underline-offset: 2px;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a.repair-request-link:hover,
a.repair-request-link:focus {
    color: #14787b;
    text-decoration-color: #14787b;
}

/* ========================================
   MODAL STYLES
   ======================================== */

#imi-repair-modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

#imi-repair-modal.open {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Idle presence confirmation overlay */
#imi-idle-presence-prompt {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0, 0, 0, 0.55);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#imi-idle-presence-prompt.open {
    display: flex;
}

.imi-idle-presence-content {
    width: 100%;
    max-width: 460px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
    padding: 24px;
}

.imi-idle-presence-content h3 {
    margin: 0 0 10px 0;
    font-size: 20px;
    color: #1f2937;
}

.imi-idle-presence-content p {
    margin: 0;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.5;
}

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

.imi-repair-modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 0;
    border: 1px solid #888;
    width: 90%;
    max-width: 700px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: imi-modal-fade-in 0.3s ease-out;
}

@keyframes imi-modal-fade-in {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.imi-repair-modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-radius: 8px 8px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.imi-repair-modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.imi-repair-close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.imi-repair-close:hover,
.imi-repair-close:focus {
    color: #000;
    text-decoration: none;
}

.imi-repair-modal-body {
    padding: 20px;
    overflow-y: auto;
}

/* Form Sections */
.imi-form-section {
    margin-bottom: 25px;
}

.imi-form-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #199ca0; /* Theme color from screenshot */
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

/* Form Grid */
.imi-form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.imi-form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.imi-form-group label {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 5px;
    color: #444;
}

.imi-form-group label .required {
    color: #e53e3e;
    margin-left: 2px;
}

.imi-form-group input[type="text"],
.imi-form-group input[type="email"],
.imi-form-group input[type="tel"],
.imi-form-group input[type="date"],
.imi-form-group textarea,
.imi-form-group select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color 0.2s;
}

.imi-form-error {
    display: none;
    border: 1px solid #f5c2c7;
    background-color: #fff5f5;
    color: #742a2a;
    padding: 10px 12px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 13px;
}

.imi-form-error.is-visible {
    display: block;
}

.imi-form-group input:focus,
.imi-form-group textarea:focus,
.imi-form-group select:focus {
    border-color: #199ca0;
    outline: none;
    box-shadow: 0 0 0 2px rgba(25, 156, 160, 0.1);
}

.imi-form-group input.imi-field-error {
    border-color: #e53e3e;
    box-shadow: 0 0 0 2px rgba(229, 62, 62, 0.15);
}

.imi-form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.imi-checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
}

.imi-checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

.imi-checkbox-group label {
    font-size: 14px;
    margin: 0;
    cursor: pointer;
}

/* Radio Buttons */
.imi-radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.imi-radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.imi-radio-item input[type="radio"] {
    margin: 0;
}

.imi-radio-item label {
    font-size: 14px;
    margin: 0;
    cursor: pointer;
}

/* Buttons */
.imi-repair-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f9f9f9;
    border-radius: 0 0 8px 8px;
}

.imi-btn {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s;
}

.imi-btn-secondary {
    background-color: #e2e8f0;
    color: #4a5568;
}

.imi-btn-secondary:hover {
    background-color: #cbd5e0;
}

.imi-btn-primary {
    background-color: #199ca0;
    color: white;
}

.imi-btn-primary:hover {
    background-color: #158588;
}

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

/* Dynamic Input Groups (Serial Numbers) */
.imi-input-group {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    width: 100%;
}

.imi-input-group + .imi-input-group {
    margin-top: 5px;
}

.imi-input-group input {
    flex: 1;
}

.imi-add-serial-btn,
.imi-remove-serial-btn {
    margin-left: 5px;
    cursor: pointer;
    padding: 0;
    width: 38px; /* Approximate height of input */
    height: 38px;
    font-weight: bold;
    font-size: 18px;
    border-radius: 4px;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.imi-add-serial-btn {
    background-color: #e2e8f0;
    color: #199ca0;
    border-color: #cbd5e0;
}

.imi-add-serial-btn:hover {
    background-color: #cbd5e0;
    color: #14787b;
}

.imi-remove-serial-btn {
    background-color: #fee2e2;
    color: #c53030;
    border-color: #fecaca;
}

.imi-remove-serial-btn:hover {
    background-color: #fecaca;
    color: #9b2c2c;
}

/* Autocomplete Suggestions */
.hub-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    border: 1px solid #ddd;
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
    background-color: white;
    z-index: 1000;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: none; /* Hidden by default */
}

.hub-suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.hub-suggestion-item:last-child {
    border-bottom: none;
}

.hub-suggestion-item:hover {
    background-color: #f0f8f8;
    color: #199ca0;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .imi-form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .imi-repair-modal-content {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .imi-repair-modal-header {
        border-radius: 0;
    }
    
    .imi-repair-modal-footer {
        border-radius: 0;
    }
    
    /* Inline form responsive */
    .imi-repair-form-container {
        margin: 15px;
        padding: 20px;
    }
    
    .imi-repair-form-title {
        font-size: 20px;
    }
    
    .imi-btn-large {
        width: 100%;
        padding: 14px 20px;
    }
}

/* ========================================
   SUCCESS STATE STYLES
   ======================================== */

.imi-form-success {
    display: none;
    text-align: center;
    padding: 40px 20px;
}

.imi-form-success.is-visible {
    display: block;
}

.imi-form-success-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    background: #199ca0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.imi-form-success-icon svg {
    width: 30px;
    height: 30px;
    fill: white;
}

.imi-form-success h3 {
    color: #199ca0;
    font-size: 20px;
    margin-bottom: 10px;
}

.imi-form-success p {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

/* ========================================
   MACHINE ENTRY STYLES (Added)
   ======================================== */

.imi-machine-entry {
    background-color: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 25px;
    position: relative;
}

.imi-machine-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

.imi-machine-header h4 {
    margin: 0;
    color: #199ca0;
    font-size: 18px;
    font-weight: 600;
}

.imi-remove-machine-btn {
    background: none;
    border: none;
    color: #e53e3e;
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline;
    padding: 5px;
}

.imi-remove-machine-btn:hover {
    color: #c53030;
    text-decoration: none;
}

.imi-add-machine-btn {
    width: 100%;
    padding: 12px;
    border: 2px dashed #cbd5e0;
    background-color: #f7fafc;
    color: #4a5568;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.2s;
}

.imi-add-machine-btn:hover {
    border-color: #199ca0;
    color: #199ca0;
    background-color: #fff;
}

/* ========================================
   FILE ATTACHMENT STYLES
   ======================================== */
   
.imi-form-group input[type="file"] {
    display: block;
    width: 100%;
    padding: 10px;
    background: #fafafa;
    border: 1px dashed #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
}

.imi-form-group input[type="file"]:hover {
    background: #f0f8f8;
    border-color: #199ca0;
}

.imi-form-group input[type="file"]::file-selector-button {
    margin-right: 15px;
    padding: 8px 16px;
    border-radius: 4px;
    background-color: #e2e8f0;
    color: #4a5568;
    border: none;
    font-weight: 500;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.2s;
}

.imi-form-group input[type="file"]::file-selector-button:hover {
    background-color: #cbd5e0;
}