/* ==================== สไตล์หลัก ==================== */
.egp-file-container {
    font-family: 'Prompt', 'Sarabun', Arial, sans-serif;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    margin: 30px 0;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(26, 75, 139, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* ==================== ส่วนหัว ==================== */
.egp-file-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(135deg, #1a4b8b 0%, #2563b3 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.egp-file-title {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
}

.egp-file-title:before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 22px;
    background-color: #ff7f27;
    margin-right: 12px;
    border-radius: 3px;
}

.egp-add-file-btn {
    display: inline-flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.egp-add-file-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.egp-add-file-btn .dashicons {
    margin-right: 8px;
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* ==================== ช่องค้นหา ==================== */
.egp-search-container {
    padding: 15px 25px;
    background-color: rgba(26, 75, 139, 0.05);
    border-bottom: 1px solid rgba(26, 75, 139, 0.1);
}

.egp-search-wrapper {
    position: relative;
    max-width: 400px;
}

.egp-search-input {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border: 1px solid rgba(26, 75, 139, 0.2);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
    outline: none;
    background-color: white;
    color: #333;
}

.egp-search-input:focus {
    border-color: #1a4b8b;
    box-shadow: 0 0 0 3px rgba(26, 75, 139, 0.15);
}

.egp-search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    pointer-events: none;
}

/* ==================== ตาราง ==================== */
.egp-file-table-container {
    overflow-x: auto;
    width: 100%;
    padding: 5px;
}

.egp-file-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
}

.egp-file-table thead th {
    padding: 15px 20px;
    font-weight: 500;
    color: #1a4b8b;
    background-color: rgba(26, 75, 139, 0.05);
    border-bottom: 2px solid rgba(26, 75, 139, 0.2);
    font-size: 14px;
    letter-spacing: 0.5px;
    position: relative;
}

.egp-file-table thead th:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background-color: #ff7f27;
    border-radius: 1px;
}

.egp-file-table tbody tr {
    transition: all 0.2s;
    border-bottom: 1px solid rgba(26, 75, 139, 0.1);
}

.egp-file-table tbody tr:last-child {
    border-bottom: none;
}

.egp-file-table tbody tr:hover,
.egp-file-table tbody tr.hover {
    background-color: rgba(26, 75, 139, 0.03);
}

.egp-file-table tbody td {
    padding: 15px 20px;
    color: #333;
    font-size: 14px;
    vertical-align: middle;
}

/* ==================== คอลัมน์ในตาราง ==================== */
.egp-file-name {
    font-weight: 500;
    width: 45%;
    display: flex;
    align-items: center;
}

.egp-file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: rgba(26, 75, 139, 0.1);
    border-radius: 6px;
    margin-right: 12px;
    color: #1a4b8b;
}

.egp-file-date {
    width: 25%;
    color: #666;
}

.egp-file-action {
    width: 20%;
    text-align: center;
}

.egp-file-manage {
    width: 10%;
    text-align: center;
    white-space: nowrap;
}

/* ==================== ปุ่มดาวน์โหลด ==================== */
.egp-download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to right, #ff7f27, #ff9a56);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    text-align: center;
    font-size: 13px;
    box-shadow: 0 2px 6px rgba(255, 127, 39, 0.3);
}

.egp-download-button:hover {
    background: linear-gradient(to right, #e56d17, #ff7f27);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 127, 39, 0.4);
    color: white;
}

.egp-download-button:active,
.egp-download-button.clicked {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(255, 127, 39, 0.2);
}

.egp-download-button .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-right: 6px;
}

/* ==================== ปุ่มแก้ไข/ลบ ==================== */
.egp-edit-file-btn,
.egp-delete-file-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: transparent;
    border: 1px solid rgba(26, 75, 139, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    margin: 0 3px;
    color: #1a4b8b;
}

.egp-edit-file-btn:hover {
    background-color: rgba(26, 75, 139, 0.1);
    color: #1a4b8b;
}

.egp-delete-file-btn:hover {
    background-color: rgba(220, 53, 69, 0.1);
    border-color: rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

/* ==================== ข้อความเมื่อไม่พบข้อมูล ==================== */
.egp-empty-state,
.egp-empty-search {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #888;
}

.egp-empty-state .dashicons,
.egp-empty-search .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    margin-bottom: 12px;
    color: rgba(26, 75, 139, 0.3);
}

.egp-empty-state p,
.egp-empty-search p {
    margin: 0;
    font-size: 14px;
}

/* ==================== การแจ้งเตือน ==================== */
.egp-notification {
    margin: 15px;
    padding: 12px 16px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    font-size: 14px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    0% {
        transform: translateY(-20px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.egp-success {
    background-color: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.2);
    color: #28a745;
}

.egp-error {
    background-color: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

.egp-notification-icon {
    margin-right: 10px;
}

/* ==================== Modal ==================== */
.egp-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s;
}

.egp-modal.open {
    visibility: visible;
    opacity: 1;
}

.egp-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.egp-modal-container {
    position: relative;
    width: 90%;
    max-width: 500px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
    transform: translateY(20px);
    transition: transform 0.3s;
    overflow: hidden;
}

.egp-modal.open .egp-modal-container {
    transform: translateY(0);
}

.egp-modal-header {
    padding: 20px 25px;
    background: linear-gradient(135deg, #1a4b8b 0%, #2563b3 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.egp-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
}

.egp-modal-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.egp-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.egp-modal-body {
    padding: 25px;
}

/* ==================== ฟอร์ม ==================== */
.egp-form-group {
    margin-bottom: 20px;
}

.egp-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.egp-form-group .required {
    color: #dc3545;
    margin-left: 2px;
}

.egp-form-group input[type="text"] {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid rgba(26, 75, 139, 0.2);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
    outline: none;
    background-color: white;
}

.egp-form-group input[type="text"]:focus {
    border-color: #1a4b8b;
    box-shadow: 0 0 0 3px rgba(26, 75, 139, 0.15);
}

/* ==================== Upload Tabs ==================== */
.egp-upload-tabs {
    border: 1px solid rgba(26, 75, 139, 0.2);
    border-radius: 6px;
    overflow: hidden;
}

.egp-tab-buttons {
    display: flex;
    border-bottom: 1px solid rgba(26, 75, 139, 0.2);
}

.egp-tab-btn {
    flex: 1;
    padding: 12px;
    background-color: #f5f7fa;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.egp-tab-btn:first-child {
    border-right: 1px solid rgba(26, 75, 139, 0.2);
}

.egp-tab-btn.active {
    background-color: white;
    color: #1a4b8b;
    box-shadow: inset 0 -2px 0 #1a4b8b;
}

.egp-tab-content {
    padding: 20px;
    display: none;
}

.egp-tab-content.active {
    display: block;
}

/* ==================== File Drop Area ==================== */
.egp-file-drop-area {
    border: 2px dashed rgba(26, 75, 139, 0.3);
    border-radius: 6px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    background-color: #f8f9fa;
}

.egp-file-drop-area.dragging {
    background-color: rgba(26, 75, 139, 0.05);
    border-color: #1a4b8b;
}

.egp-drop-instructions {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #666;
    font-size: 14px;
}

.egp-drop-instructions .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    margin-bottom: 10px;
    color: #1a4b8b;
}

.egp-file-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.egp-browse-btn {
    margin-top: 15px;
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, #1a4b8b 0%, #2563b3 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.egp-browse-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(26, 75, 139, 0.2);
}

.egp-file-name-display {
    margin-top: 15px;
    font-size: 14px;
}

.egp-selected-file {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background-color: #f0f4f8;
    border-radius: 6px;
    border-left: 3px solid #1a4b8b;
}

.egp-selected-file .dashicons {
    margin-right: 10px;
    color: #1a4b8b;
}

/* ==================== Media Select Area ==================== */
.egp-media-select-area {
    text-align: center;
    padding: 20px 0;
}

.egp-select-media-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #1a4b8b 0%, #2563b3 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
}

.egp-select-media-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(26, 75, 139, 0.2);
}

.egp-select-media-btn .dashicons {
    margin-right: 8px;
}

.egp-file-preview {
    margin-top: 15px;
    border-radius: 6px;
    overflow: hidden;
    background-color: rgba(26, 75, 139, 0.05);
    border: 1px solid rgba(26, 75, 139, 0.1);
    min-height: 50px;
}

.egp-file-preview img {
    max-width: 100%;
    max-height: 200px;
    display: block;
    margin: 0 auto;
}

.egp-file-icon-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    flex-direction: column;
}

.egp-file-icon-preview .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    color: #1a4b8b;
    margin-bottom: 8px;
}

.egp-file-ext {
    background-color: rgba(26, 75, 139, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #1a4b8b;
    text-transform: uppercase;
    font-weight: 500;
}

.egp-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 25px;
}

.egp-cancel-btn,
.egp-save-btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.egp-cancel-btn {
    background-color: #f1f3f5;
    border: 1px solid #dee2e6;
    color: #495057;
    margin-right: 10px;
}

.egp-cancel-btn:hover {
    background-color: #e9ecef;
}

.egp-save-btn {
    background: linear-gradient(to right, #ff7f27, #ff9a56);
    color: white;
    border: none;
    box-shadow: 0 2px 6px rgba(255, 127, 39, 0.3);
}

.egp-save-btn:hover {
    background: linear-gradient(to right, #e56d17, #ff7f27);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 127, 39, 0.4);
}

.egp-save-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ==================== สำหรับหน้าจอขนาดต่างๆ ==================== */
@media (max-width: 768px) {
    .egp-file-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .egp-add-file-btn {
        margin-top: 10px;
        align-self: flex-start;
    }
    
    .egp-file-table thead th, 
    .egp-file-table tbody td {
        padding: 12px 15px;
        font-size: 13px;
    }
    
    .egp-btn-text {
        display: none;
    }
    
    .egp-download-button {
        padding: 8px;
        width: 36px;
        height: 36px;
    }
    
    .egp-download-button .dashicons {
        margin-right: 0;
    }
    
    .egp-modal-container {
        width: 95%;
        max-width: 450px;
    }
}

@media (max-width: 576px) {
    .egp-file-name {
        width: 40%;
    }
    
    .egp-file-date {
        width: 30%;
    }
    
    .egp-file-action,
    .egp-file-manage {
        width: 15%;
    }
    
    .egp-file-table thead th, 
    .egp-file-table tbody td {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .egp-form-actions {
        flex-direction: column;
    }
    
    .egp-cancel-btn,
    .egp-save-btn {
        width: 100%;
        margin-right: 0;
        text-align: center;
    }
    
    .egp-cancel-btn {
        margin-bottom: 10px;
    }
}

/* เพิ่มเอฟเฟกต์เรืองแสงสำหรับสไตล์ไฮเทค */
.egp-add-file-btn, .egp-download-button, .egp-save-btn, .egp-browse-btn, .egp-select-media-btn {
    position: relative;
    overflow: hidden;
}

.egp-add-file-btn:before, .egp-download-button:before, .egp-save-btn:before, .egp-browse-btn:before, .egp-select-media-btn:before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to bottom right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.1) 100%
    );
    transform: rotate(30deg);
    transition: transform 0.6s;
    pointer-events: none;
}

.egp-add-file-btn:hover:before, .egp-download-button:hover:before, .egp-save-btn:hover:before, .egp-browse-btn:hover:before, .egp-select-media-btn:hover:before {
    transform: rotate(0deg);
}

/* เพิ่ม box-shadow เพื่อความรู้สึกลอยตัว */
.egp-file-container {
    box-shadow: 0 10px 25px rgba(26, 75, 139, 0.1), 0 0 0 1px rgba(26, 75, 139, 0.05);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.egp-file-container:hover {
    box-shadow: 0 15px 35px rgba(26, 75, 139, 0.15), 0 0 0 1px rgba(26, 75, 139, 0.1);
    transform: translateY(-2px);
}

/* เพิ่ม transition สำหรับทุก element */
*, *:before, *:after {
    transition: all 0.2s ease;
}

/* สไตล์สำหรับ body เมื่อเปิด Modal */
body.egp-modal-open {
    overflow: hidden;
}