/* Modal Styles */
.edit-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 2vh;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.edit-modal.show {
    background: rgba(0, 0, 0, 0.5);
    opacity: 1;
    visibility: visible;
}

.edit-modal-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 1200px;
    width: 95%;
    max-height: 94vh;
    overflow-y: auto;
    margin-bottom: 2vh;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.edit-modal.show .edit-modal-content {
    transform: scale(1);
}

.edit-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.edit-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

.edit-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.edit-close-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.edit-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

/* Edit Modal Tabs */
.edit-tabs {
    display: flex;
    margin-bottom: 24px;
    border-bottom: 2px solid #f1f5f9;
}

.edit-tab {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.edit-tab.active {
    color: #6366f1;
    border-bottom-color: #6366f1;
}

.edit-tab:hover {
    color: #4f46e5;
}

.edit-tab-content {
    display: none;
}

.edit-tab-content.active {
    display: block;
}

/* Edit Form */
.edit-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.edit-form-group {
    display: flex;
    flex-direction: column;
}

.edit-form-group label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.edit-form-group input,
.edit-form-group select,
.edit-form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background: white;
}

.edit-form-group input:focus,
.edit-form-group select:focus,
.edit-form-group textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Line Items Section */
.edit-items-section {
    margin-top: 20px;
}

.edit-items-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.edit-items-header h4 {
    color: #1e293b;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.edit-items-column-headers {
    display: grid;
    grid-template-columns: 150px 2fr 100px 120px 1.5fr auto;
    gap: 12px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
}

.header-cell {
    text-align: left;
}

.edit-items-container {
    max-height: 400px;
    overflow-y: auto;
}

.edit-item-row {
    display: grid;
    grid-template-columns: 150px 2fr 100px 120px 1.5fr auto;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    align-items: center;
    transition: all 0.2s ease;
}

.edit-item-row:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.edit-item-row input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
}

.edit-item-row input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.edit-item-remove {
    background: #ef4444;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.edit-item-remove:hover {
    background: #dc2626;
}

.edit-add-item {
    background: #10b981;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.2s;
}

.edit-add-item:hover {
    background: #059669;
}

.edit-items-empty {
    text-align: center;
    color: #64748b;
    padding: 40px 20px;
    font-style: italic;
}

/* Confirmation Modal */
.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.confirm-modal.show {
    opacity: 1;
    visibility: visible;
}

.confirm-modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.confirm-modal.show .confirm-modal-content {
    transform: scale(1);
}

.confirm-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
}

.confirm-modal-message {
    color: #64748b;
    margin-bottom: 24px;
    line-height: 1.5;
}

.confirm-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Loading Modal */
.loading-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1200;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-modal.show {
    opacity: 1;
    visibility: visible;
}

.loading-modal-content {
    background: white;
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 300px;
    width: 90%;
}

.loading-spinner-large {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-radius: 50%;
    border-top-color: #6366f1;
    animation: spin 0.8s ease-in-out infinite;
    margin: 0 auto 16px;
}

.loading-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}

.loading-subtext {
    color: #64748b;
    font-size: 0.9rem;
}