/* === MODAL (POPUP) STYLES === */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(0);
}

.modal.active {
    display: grid;
    opacity: 1;
    pointer-events: all;
    animation: blurFadeIn 0.3s ease forwards;
}

.modal.hide {
    animation: blurFadeOut 0.3s ease forwards;
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 30px;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    transform: translateY(15px);
    opacity: 0;
}

.modal.active .modal-content,
.modal.active .confirm-modal-content

/* Add this for confirmation modal animation */
    {
    animation: slideUpBlurred 0.3s cubic-bezier(0.2, 0, 0, 1) 0.1s forwards;
}

.modal-close-btn {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.modal-close-btn:hover,
.modal-close-btn:focus {
    color: black;
    text-decoration: none;
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-family: 'Prompt', sans-serif;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.login-result {
    padding-top: 0.5rem;
}

.login-result.shake {
    animation: horizontalShaking 0.5s;
}

.ticket-actions btn-submit,
.ticket-actions btn-cancel {
    padding: 10px 20px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-family: 'Prompt', sans-serif;
}

.btn-submit {
    background-color: var(--primary-color);
    color: white;
    transition: 0.3s;
}

.btn-submit:hover {
    background-color: #2a5346;
    transition: 0.3s;
}

.ticket-actions btn-cancel {
    background-color: #6c757d;
    color: white;
}

.required:after {
    content: " *";
    color: red;
}

.login-text {
    position: absolute;
    top: 5px;
    right: 16px;
    transition: 0.3s;
}

.login-text_hover:hover {
    color: var(--primary-color);
    transition: 0.3s;
    transform: translateY(-1px);
    cursor: pointer;
}

@keyframes blurFadeIn {
    0% {
        opacity: 0;
        backdrop-filter: blur(0);
    }

    100% {
        opacity: 1;
        backdrop-filter: blur(10px);
    }
}

@keyframes blurFadeOut {
    0% {
        opacity: 1;
        backdrop-filter: blur(10px);
    }

    100% {
        opacity: 0;
        backdrop-filter: blur(0);
    }
}

@keyframes slideUpBlurred {
    0% {
        transform: translateY(15px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes horizontal-shaking {
    0% {
        transform: translateX(0)
    }

    25% {
        transform: translateX(5px)
    }

    50% {
        transform: translateX(-5px)
    }

    75% {
        transform: translateX(5px)
    }

    100% {
        transform: translateX(0)
    }
}

/* สไตล์สำหรับสถานะใหม่ */
.status-pill.approved {
    background-color: #6f42c1;
    color: white;
}

.status-pill.inprogress1 {
    background-color: #fd7e14;
    color: white;
}

.status-pill.inprogress2 {
    background-color: #20c997;
    color: white;
}

.status-pill.inprogress3 {
    background-color: #17a2b8;
    color: white;
}

.status-card.approved {
    border-left: 4px solid #6f42c1;
}

.status-card.inprogress1 {
    border-left: 4px solid #fd7e14;
}

.status-card.inprogress2 {
    border-left: 4px solid #20c997;
}

.status-card.inprogress3 {
    border-left: 4px solid #17a2b8;
}

.status-pill.started {
    background-color: #6c757d;
    /* สีเทา */
    color: white;
}

.status-card.started {
    border-left: 4px solid #6c757d;
}

/* ปรับสไตล์สำหรับ filter dropdown */
#filter-status {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.btn-warning {
    background-color: #ffc107;
    color: #000;
    transition: 0.3s;
}

.btn-warning:hover {
    background-color: #e0a800;
}

.btn-success {
    background-color: #28a745;
    color: white;
    transition: 0.3s;
}

.btn-success:hover {
    background-color: #218838;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.hidden {
    display: none !important;
}

#confirmModal {
    z-index: 3001 !important;
}

#confirmModal .confirm-modal-content {
    z-index: 3100 !important;
}

/* --- เพิ่มสวยงามให้กับ Confirmation Modal --- */
#confirmModal {
    background-color: rgba(0, 0, 0, 0.5);
    /* สีพื้นหลังทึมๆ โปร่งแสง */
    backdrop-filter: blur(8px);
    /* เบลอพื้นหลังด้านหลัง */
    transition: background-color 0.3s ease;
}

#confirmModal.success {
    background-color: rgba(46, 204, 113, 0.15);
    /* โทนสีเขียวโปร่งแสงสำหรับ success */
    backdrop-filter: blur(10px);
}

#confirmModal.danger {
    background-color: rgba(231, 76, 60, 0.15);
    /* โทนสีแดงโปร่งแสงสำหรับ danger */
    backdrop-filter: blur(10px);
}

#confirmModal .confirm-modal-content {
    background: linear-gradient(135deg, #ffffffee, #f0f4f7ee);
    box-shadow:
        0 8px 24px rgb(149 157 165 / 0.2),
        0 6px 12px rgb(107 119 140 / 0.15);
    border-radius: 15px;
    padding: 2rem 2.5rem;
    max-width: 480px;
    width: 90%;
    color: #333;
    font-family: 'Prompt', sans-serif;
    text-align: center;
    position: relative;
    animation: slideUpBlurred 0.35s cubic-bezier(0.2, 0, 0, 1) forwards;
}

#confirmModal .modal-icon-container {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 0.8rem;
}

#confirmModal.success .modal-icon-container {
    color: #2ecc71;
    /* เขียว */
}

#confirmModal.danger .modal-icon-container {
    color: #e74c3c;
    /* แดง */
}

#confirmModal .cfm-modal-btn {
    padding: 0.6em 1.6em;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    font-family: 'Prompt', sans-serif;
    transition: background-color 0.3s ease;
}

#confirmModal .cfm-modal-btn.confirm {
    background-color: var(--primary-color);
    color: white;
    margin-left: 1rem;
}

#confirmModal .cfm-modal-btn.confirm:hover {
    background-color: #2a5346;
}

#confirmModal .cfm-modal-btn.cancel {
    background-color: #6c757d;
    color: white;
}

#confirmModal .cfm-modal-btn.cancel:hover {
    background-color: #5a6268;
}

/* ทำให้ข้อความหัวข้อ และข้อความอ่านง่าย */
#confirmModalTitle {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.7rem;
    color: var(--primary-color);
}

#confirmModalMessage {
    font-size: 1.1rem;
    line-height: 1.4;
    margin-bottom: 1.8rem;
    color: #444;
}

/* ทำให้ปุ่มวางชิดขวา */
#confirmModal .confirm-modal-footer {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

#confirmModal .confirm-modal-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

#confirmModal .confirm-modal-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

#confirmModal .confirm-modal-error {
    color: #dc3545;
    font-size: 0.875em;
    margin-top: 5px;
}

#confirmModal.has-input .modal-content {
    min-width: 350px;
}

/* แอนิเมชัน slide up */
@keyframes slideUpBlurred {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes horizontalShaking {
    0% {
        transform: translateX(0)
    }

    25% {
        transform: translateX(5px)
    }

    50% {
        transform: translateX(-5px)
    }

    75% {
        transform: translateX(5px)
    }

    100% {
        transform: translateX(0)
    }
}

.detail-item h5 {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    background: none;
    border: none;
    color: #555;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}

.btn-icon:hover {
    background-color: #f0f0f0;
    color: #000;
}

#am-detail-edit-container textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Prompt', sans-serif;
    resize: vertical;
    margin-bottom: 8px;
}

.edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.hidden {
    display: none;
}