/* Work Orders - Clean Styles (NO DUPLICATES) */

/* ==============================
   MODAL & OVERLAY STYLES
   ============================== */

.work-order-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 999;
    align-items: center;
    justify-content: center;
}

.work-order-overlay.active {
    display: flex !important;
}

.work-order-modal {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 95vw;          /* 95% of viewport width */
    max-width: 95vw;      /* Maximum 95% of viewport width */
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease-out;
    z-index: 1000;
    position: relative;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 2px solid #f0b05d;
    background: #f8f9fa;
}

.modal-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 22px;
    font-weight: 600;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: #e9ecef;
    color: #333;
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 20px 30px;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
}

/* ==============================
   FORM STYLES
   ============================== */

.work-order-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.form-section {
    margin-bottom: 25px;
}

.form-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0b05d;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
}

.form-row.full-width {
    grid-template-columns: 1fr;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
}

.form-group label .required {
    color: #dc3545;
    margin-left: 3px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
    background-color: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #f0b05d;
    box-shadow: 0 0 0 3px rgba(240, 176, 93, 0.1);
}

.form-group input:disabled,
.form-group select:disabled {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

.form-group input[readonly] {
    background-color: #f5f5f5 !important;
    color: #666 !important;
    cursor: default !important;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
    cursor: pointer;
}

/* ==============================
   INFO BOXES & DISPLAYS
   ============================== */

.info-box {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 12px 15px;
    border-radius: 4px;
    font-size: 13px;
    color: #1565c0;
    margin-bottom: 15px;
}

.info-box.success {
    background: #e8f5e9;
    border-left-color: #4caf50;
    color: #2e7d32;
}

.info-box.warning {
    background: #fff3e0;
    border-left-color: #ff9800;
    color: #e65100;
}

.info-box.error {
    background: #ffebee;
    border-left-color: #f44336;
    color: #c62828;
}

.info-display {
    background: #f8f9fa;
    padding: 12px 15px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.info-display-label {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.info-display-value {
    font-size: 15px;
    font-weight: 600;
    color: #2c3e50;
}

/* ==============================
   STATUS & PRIORITY COLORS
   ============================== */

.work-order-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-new {
    background: #cfe8fc;
    color: #0c5aa0;
}

.status-in-progress {
    background: #fce4ec;
    color: #880e4f;
}

.status-completed {
    background: #c8e6c9;
    color: #1b5e20;
}

.status-on-hold {
    background: #ffe0b2;
    color: #e65100;
}

.status-cancelled {
    background: #f5f5f5;
    color: #424242;
}

.priority-high {
    color: #dc3545;
    font-weight: 600;
}

.priority-medium {
    color: #ff9800;
    font-weight: 600;
}

.priority-low {
    color: #28a745;
    font-weight: 600;
}

.priority-critical {
    color: #c71c1c;
    font-weight: 600;
}

/* ==============================
   LOADING & SUCCESS STATES
   ============================== */

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(240, 176, 93, 0.3);
    border-top-color: #f0b05d;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==============================
   HELPER CLASSES
   ============================== */

.text-muted {
    color: #6c757d;
    font-size: 12px;
}

.text-success {
    color: #28a745;
}

.text-error {
    color: #dc3545;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* ==============================
   ROLE BADGE STYLES
   ============================== */

.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 10px;
}

.role-admin {
    background: #e74c3c;
    color: white;
}

.role-manager {
    background: #3498db;
    color: white;
}

.role-supervisor {
    background: #f39c12;
    color: white;
}

.role-technician {
    background: #27ae60;
    color: white;
}

.role-operator {
    background: #9b59b6;
    color: white;
}

.role-viewer {
    background: #95a5a6;
    color: white;
}

/* ==============================
   SIDEBAR USER INFO STYLES
   ============================== */

.sidebar-user-info {
    padding: 20px 15px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 10px;
}
/*
.user-avatar {
    width: 80px;
    height: 80px;
    margin: 0 auto 10px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #f0b05d;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name {
    color: white;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 5px;
}

.user-role {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
    display: inline-block;
}
*/
/* ==============================
   RESPONSIVE DESIGN
   ============================== */

@media (max-width: 768px) {
    .work-order-modal {
        width: 95%;
        max-height: 95vh;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .modal-header {
        padding: 15px;
    }

    .modal-header h2 {
        font-size: 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-footer {
        padding: 15px 20px;
        flex-direction: column-reverse;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .work-order-modal {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .form-section-title {
        font-size: 15px;
    }

    .form-group label {
        font-size: 13px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
    }

    .modal-header h2 {
        font-size: 18px;
    }
}

.detail-container {
    background: white;
    padding: 30px;
    margin: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    border-bottom: 2px solid #f0b05d;
    padding-bottom: 15px;
}

.back-btn {
    padding: 8px 15px;
    background: #244855;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.detail-section {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.detail-section.full-width {
    grid-column: span 2;
}

.detail-section h3 {
    margin-top: 0;
    font-size: 16px;
    color: #244855;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

#workOrderDetailSection {
    background: #f4f7f6;
    min-height: 100vh;
}

.detail-container {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.back-btn {
    background: #244855;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 20px;
}

.back-btn:hover {
    background: #f0b05d;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.detail-section {
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 6px;
}

/* Comment Modal Styles */
.comment-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.comment-modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    animation: slideIn 0.3s ease-out;
    z-index: 10001;
}

.comment-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid #f0b05d;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.comment-modal-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 18px;
}

.comment-modal-body {
    padding: 25px;
}

.comment-modal-body textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    box-sizing: border-box;
    margin-bottom: 8px;
}

.comment-modal-body textarea:focus {
    outline: none;
    border-color: #f0b05d;
    box-shadow: 0 0 0 3px rgba(240, 176, 93, 0.2);
}

.comment-modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 20px 25px;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

.comment-modal-footer .btn {
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.comment-modal-footer .btn-cancel {
    background: #6c757d;
    color: white;
    border: none;
}

.comment-modal-footer .btn-cancel:hover {
    background: #5a6268;
}

.comment-modal-footer .btn {
    background: #f0b05d;
    color: white;
    border: none;
}

.comment-modal-footer .btn:hover {
    background: #e09d3e;
}

/* Modal animation */
@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}


/************************************/

/* Assign Work Modal Styles */
.assign-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.assign-modal-overlay.active {
    display: flex !important;
}

.assign-modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease-out;
    z-index: 10001;
}

.assign-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid #f0b05d;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.assign-modal-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 18px;
}

.assign-modal-body {
    padding: 25px;
}

.assign-form-group {
    margin-bottom: 20px;
}

.assign-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #495057;
}

.assign-form-group select,
.assign-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.assign-form-group select:focus,
.assign-form-group textarea:focus {
    outline: none;
    border-color: #f0b05d;
    box-shadow: 0 0 0 3px rgba(240, 176, 93, 0.1);
}

.assign-checklists-container {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 10px;
    background: #f8f9fa;
}

.assign-checklist-item {
    padding: 10px;
    margin-bottom: 5px;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.assign-checklist-item:hover {
    background: #e9ecef;
}

.assign-checklist-item.selected {
    background: #e3f2fd;
    border-left: 3px solid #f0b05d;
}

.assign-checklist-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.assign-checklist-info {
    flex: 1;
}

.assign-checklist-info h4 {
    margin: 0;
    font-size: 14px;
    color: #2c3e50;
}

.assign-checklist-info p {
    margin: 3px 0 0;
    font-size: 11px;
    color: #6c757d;
}

.assign-modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 20px 25px;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

.assign-modal-footer .btn {
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.assign-modal-footer .btn-cancel {
    background: #6c757d;
    color: white;
    border: none;
}

.assign-modal-footer .btn-cancel:hover {
    background: #5a6268;
}

.assign-modal-footer .btn-primary {
    background: #f0b05d;
    color: white;
    border: none;
}

.assign-modal-footer .btn-primary:hover {
    background: #e09d3e;
}

/* Assign Work Button */
.status-btn-assign {
    background: #6c5ce7;
    color: white;
}

.status-btn-assign:hover {
    background: #5b4bc4;
}

/* Checklist item selected state */
.assign-checklist-item.selected {
    background: #e3f2fd;
    border-left: 3px solid #f0b05d;
}

/* Icon Action Button Styles - Matching Maintenance Page */
.btn-icon-action {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-action:hover {
    background-color: #e9ecef;
    transform: scale(1.05);
}

.btn-icon-action:active {
    transform: scale(0.95);
}

.action-icon {
    width: 18px;
    height: 18px;
    display: block;
}

/* Make the actions column center-aligned */
.data-table td:last-child,
.data-table th:last-child {
    text-align: center;
    width: 60px;
}

/* Priority Badge Styles - Matching Status Badge Style */
.priority-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.priority-critical {
    background: #ffebee;
    color: #c62828;
}

.priority-high {
    background: #ffebee;
    color: #dc3545;
}

.priority-medium {
    background: #fff3e0;
    color: #ff9800;
}

.priority-low {
    background: #e8f5e9;
    color: #28a745;
}

/* Overdue Badge */
.overdue-badge {
    display: inline-block;
    padding: 2px 6px;
    background: #dc3545;
    color: white;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 5px;
}

/* Actions Cell Styles */
.actions-cell {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.actions-cell .btn-icon-action {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.actions-cell .btn-icon-action:hover {
    background-color: #e9ecef;
    transform: scale(1.05);
}

.actions-cell .btn-icon-action:active {
    transform: scale(0.95);
}

.action-icon {
    width: 18px;
    height: 18px;
    display: block;
}

/* Make table more readable */
.data-table td {
    vertical-align: middle;
    padding: 12px;
}

/* Status badge styles (already in your CSS, but ensure they exist) */
.status-new {
    background: #cfe8fc;
    color: #0c5aa0;
}

.status-in-progress {
    background: #fce4ec;
    color: #880e4f;
}

.status-completed {
    background: #c8e6c9;
    color: #1b5e20;
}

.status-on-hold {
    background: #ffe0b2;
    color: #e65100;
}

.status-cancelled {
    background: #f5f5f5;
    color: #424242;
}