@import url('main.css');

/* === USER FORM ELEMENTS === */
.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group.half {
    flex: 1;
    margin-bottom: 0;
}

textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-family: 'Sarabun';
    resize: vertical;
    outline: none;
    transition: border 0.3s;
}

textarea:focus {
    border-color: var(--primary);
}

.btn-submit {
    width: 100%;
    padding: 14px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
    transition: transform 0.2s;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.3);
}

.btn-submit:hover {
    transform: translateY(-2px);
    background: #059669;
}

/* === EQUIPMENT CHECKBOX GRID === */
.equip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.equip-item {
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 10px;
    transition: all 0.2s;
    background: #fff;
    position: relative;
}

.equip-item:hover {
    border-color: var(--primary-light);
    background: #fdfcff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.equip-cb {
    margin-right: 5px;
    transform: scale(1.2);
}

.equip-item label {
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
}

.qty-input {
    width: 100%;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-top: 8px;
    text-align: center;
    font-family: 'Sarabun';
}

.qty-input:disabled {
    background: #f1f5f9;
    cursor: not-allowed;
    opacity: 0.6;
}

.other-input-text {
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: none;
    font-family: 'Sarabun';
}

/* === TABLE STYLES === */
.list-card table {
    width: 100%;
    border-collapse: collapse;
}

.list-card table th,
.list-card table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

/* ล็อกคอลัมน์ที่ 1 และ 2 (วันที่) ไม่ให้ตัดบรรทัด */
.list-card table td:nth-child(1),
.list-card table td:nth-child(2) {
    white-space: nowrap;
    width: 1%;
}

/* === ITEM TAGS/BADGES === */
.item-tags-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.item-tag {
    display: inline-flex;
    align-items: center;
    background-color: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0369a1;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
    margin-bottom: 2px;
}

.item-tag:hover {
    background-color: #e0f2fe;
    transform: translateY(-1px);
}

.item-qty-badge {
    background-color: var(--primary, #0ea5e9);
    color: white;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    margin-left: 6px;
    font-weight: 700;
}

/* === PAGINATION STYLES === */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.btn-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    color: #475569;
    font-family: 'Sarabun', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-page:hover:not(:disabled) {
    border-color: var(--primary, #0ea5e9);
    color: var(--primary, #0ea5e9);
    background-color: #f0f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(14, 165, 233, 0.15);
}

.btn-page:active:not(:disabled) {
    transform: translateY(0);
}

.btn-page:disabled {
    background-color: #f8fafc;
    border-color: #e2e8f0;
    color: #cbd5e1;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.page-info {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 600;
    background: #f1f5f9;
    padding: 6px 14px;
    border-radius: 20px;
    user-select: none;
}

/* ===================================== */
/* === CONFIRMATION MODAL STYLES === */
/* ===================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
    padding: 20px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    color: white;
    padding: 20px 24px;
    border-radius: 16px 16px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
}

.modal-body {
    padding: 24px;
}

.confirm-detail {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.confirm-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 12px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 10px;
    align-items: start;
    transition: all 0.2s;
}

.confirm-row:hover {
    background: #f1f5f9;
    transform: translateX(4px);
}

.confirm-label {
    font-weight: 600;
    color: #475569;
    font-size: 0.95rem;
}

.confirm-value {
    color: #1e293b;
    font-size: 0.95rem;
    word-wrap: break-word;
}

.confirm-value.highlight {
    color: var(--primary);
    font-weight: 700;
    font-size: 1rem;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 0 0 16px 16px;
}

.btn-cancel,
.btn-confirm {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Sarabun', sans-serif;
}

.btn-cancel {
    background: white;
    color: #64748b;
    border: 2px solid #cbd5e1;
}

.btn-cancel:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    transform: translateY(-2px);
}

.btn-confirm {
    background: var(--success);
    color: white;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.3);
}

.btn-confirm:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(16, 185, 129, 0.4);
}

.btn-confirm:active,
.btn-cancel:active {
    transform: translateY(0);
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
    .page-grid {
        grid-template-columns: 1fr;
    }

    .equip-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        gap: 10px;
    }

    .table-responsive {
        overflow-x: auto;
    }

    /* ปรับแต่ง Pagination ในมือถือ */
    .pagination-container {
        gap: 10px;
        margin-top: 15px;
        padding-top: 15px;
    }
    .btn-page {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    /* ปรับแต่ง Modal ในมือถือ */
    .modal-content {
        max-width: 95%;
        margin: 10px;
    }

    .modal-header h3 {
        font-size: 1.1rem;
    }

    .confirm-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .confirm-label {
        font-size: 0.85rem;
    }

    .confirm-value {
        font-size: 0.9rem;
    }

    .modal-footer {
        flex-direction: column;
    }

    .btn-cancel,
    .btn-confirm {
        width: 100%;
    }
}