/* ==========================================================
   POST TO API MODAL STYLES (Light & Dark Theme Support)
   Separated from Blade views as per user guidelines
   ========================================================== */

.post-api-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.25s ease;
}

.post-api-modal-backdrop.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.post-api-modal-dialog {
    position: relative;
    width: 100%;
    max-width: 460px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35), 0 10px 15px -3px rgba(15, 23, 42, 0.15);
    overflow: hidden;
    transform: translateY(0) scale(1);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}

.post-api-modal-backdrop.hidden .post-api-modal-dialog {
    transform: translateY(12px) scale(0.96);
    opacity: 0;
}

html.dark .post-api-modal-dialog {
    background: #1a3243;
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.65), 0 10px 20px -5px rgba(0, 0, 0, 0.45);
}

/* Modal Header */
.post-api-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.15rem 1.35rem 0.9rem;
    border-bottom: 1px solid #f1f5f9;
}

html.dark .post-api-modal-header {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.post-api-modal-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.015em;
}

html.dark .post-api-modal-title {
    color: #f8fafc;
}

.post-api-modal-close {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    color: #94a3b8;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.post-api-modal-close:hover {
    color: #0f172a;
    background: #f1f5f9;
}

html.dark .post-api-modal-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

/* Modal Body */
.post-api-modal-body {
    padding: 1.15rem 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

/* API Endpoint Box */
.post-api-endpoint-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.6rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

html.dark .post-api-endpoint-box {
    background: rgba(18, 34, 46, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
}

.post-api-method-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.45rem;
    background: #ede9fe;
    color: #6d28d9;
    border: 1px solid #ddd6fe;
    border-radius: 0.35rem;
    font-size: 0.675rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

html.dark .post-api-method-badge {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
    border-color: rgba(167, 139, 250, 0.3);
}

.post-api-endpoint-url {
    font-size: 0.725rem;
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

html.dark .post-api-endpoint-url {
    color: #94a3b8;
}

/* Records Overview Card */
.post-api-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 0.95rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

html.dark .post-api-card {
    background: rgba(18, 34, 46, 0.85);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.post-api-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.post-api-card-title-group {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.post-api-card-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
}

html.dark .post-api-card-title {
    color: #cbd5e1;
}

.post-api-spinner-inline {
    font-size: 0.8125rem;
}

.post-api-count-display {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

.post-api-record-count {
    font-size: 1.85rem;
    font-weight: 800;
    color: #7c3aed;
    line-height: 1;
    letter-spacing: -0.02em;
}

html.dark .post-api-record-count {
    color: #a78bfa;
}

.post-api-record-label {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 500;
}

html.dark .post-api-record-label {
    color: #94a3b8;
}

.post-api-criteria-box {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.725rem;
    color: #64748b;
    padding-top: 0.45rem;
    border-top: 1px solid #f1f5f9;
}

html.dark .post-api-criteria-box {
    color: #94a3b8;
    border-top-color: rgba(255, 255, 255, 0.06);
}

.post-api-criteria-box code {
    background: #f1f5f9;
    padding: 0.1rem 0.35rem;
    border-radius: 0.25rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.7rem;
    color: #475569;
}

html.dark .post-api-criteria-box code {
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
}

/* In-Progress Status Indicator */
.post-api-progress-box {
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    border-radius: 0.75rem;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

html.dark .post-api-progress-box {
    background: rgba(124, 58, 237, 0.12);
    border-color: rgba(167, 139, 250, 0.25);
}

.post-api-progress-content {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
}

.post-api-progress-details {
    flex: 1;
}

.post-api-progress-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #6d28d9;
}

html.dark .post-api-progress-title {
    color: #c4b5fd;
}

.post-api-progress-sub {
    font-size: 0.725rem;
    color: #7c3aed;
    opacity: 0.85;
    margin-top: 0.15rem;
}

html.dark .post-api-progress-sub {
    color: #ddd6fe;
}

.post-api-progress-bar-container {
    height: 4px;
    width: 100%;
    background: #e9d5ff;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

html.dark .post-api-progress-bar-container {
    background: rgba(167, 139, 250, 0.2);
}

.post-api-progress-bar-indeterminate {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    background: #7c3aed;
    border-radius: 2px;
    animation: postApiIndeterminate 1.4s ease-in-out infinite;
}

.post-api-progress-bar-fill {
    height: 100%;
    background: #7c3aed;
    border-radius: 2px;
    transition: width 0.3s ease;
}

html.dark .post-api-progress-bar-fill {
    background: #a78bfa;
}

@keyframes postApiIndeterminate {
    0% {
        left: -40%;
    }
    50% {
        left: 40%;
        width: 50%;
    }
    100% {
        left: 100%;
        width: 30%;
    }
}

/* Error Alert */
.post-api-alert {
    padding: 0.65rem 0.85rem;
    border-radius: 0.6rem;
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

html.dark .post-api-alert {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(248, 113, 113, 0.3);
    color: #fca5a5;
}

/* Success Card */
.post-api-success {
    padding: 0.85rem 1rem;
    border-radius: 0.75rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

html.dark .post-api-success {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(52, 211, 153, 0.25);
}

.post-api-stats-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.45rem;
}

.post-api-stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.55rem;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    font-weight: 600;
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

html.dark .post-api-stat-badge {
    background: rgba(16, 185, 129, 0.2);
    color: #86efac;
    border-color: rgba(52, 211, 153, 0.3);
}

/* Modal Footer */
.post-api-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
    padding: 0.9rem 1.35rem 1.15rem;
    border-top: 1px solid #f1f5f9;
    background: #fafafa;
}

html.dark .post-api-modal-footer {
    border-top-color: rgba(255, 255, 255, 0.08);
    background: rgba(18, 34, 46, 0.5);
}

.post-api-btn-cancel {
    padding: 0.55rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 0.6rem;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
}

.post-api-btn-cancel:hover {
    background: #f8fafc;
    color: #0f172a;
}

html.dark .post-api-btn-cancel {
    background: #1a3243;
    border-color: rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
}

html.dark .post-api-btn-cancel:hover {
    background: #233e52;
    color: #ffffff;
}

.post-api-btn-submit {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1.15rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 0.6rem;
    border: 1px solid transparent;
    background: #7c3aed;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(124, 58, 237, 0.2);
}

.post-api-btn-submit:hover:not(:disabled) {
    background: #6d28d9;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.35);
}

.post-api-btn-submit:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    opacity: 0.65;
    box-shadow: none;
}

html.dark .post-api-btn-submit:disabled {
    background: #475569;
    color: #94a3b8;
}

/* Toast Container & Toasts */
.post-api-toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 380px;
    width: calc(100% - 3rem);
    pointer-events: none;
}

.post-api-toast {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.25), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}

.post-api-toast.show {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.post-api-toast.toast-success {
    background: #ffffff;
    border-left: 4px solid #10b981;
    border-top: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

html.dark .post-api-toast.toast-success {
    background: #1a3243;
    border-left-color: #10b981;
    border-top-color: rgba(255, 255, 255, 0.12);
    border-right-color: rgba(255, 255, 255, 0.12);
    border-bottom-color: rgba(255, 255, 255, 0.12);
}

.post-api-toast.toast-error {
    background: #ffffff;
    border-left: 4px solid #ef4444;
    border-top: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

html.dark .post-api-toast.toast-error {
    background: #1a3243;
    border-left-color: #ef4444;
    border-top-color: rgba(255, 255, 255, 0.12);
    border-right-color: rgba(255, 255, 255, 0.12);
    border-bottom-color: rgba(255, 255, 255, 0.12);
}

.post-api-toast-icon {
    font-size: 1.15rem;
    margin-top: 0.1rem;
    flex-shrink: 0;
}

.post-api-toast.toast-success .post-api-toast-icon {
    color: #10b981;
}

.post-api-toast.toast-error .post-api-toast-icon {
    color: #ef4444;
}

.post-api-toast-content {
    flex: 1;
    min-width: 0;
}

.post-api-toast-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.25;
}

html.dark .post-api-toast-title {
    color: #f8fafc;
}

.post-api-toast-message {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.2rem;
    line-height: 1.35;
}

html.dark .post-api-toast-message {
    color: #94a3b8;
}

.post-api-toast-close {
    color: #94a3b8;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 0.25rem;
    transition: color 0.15s ease;
}

.post-api-toast-close:hover {
    color: #0f172a;
}

html.dark .post-api-toast-close:hover {
    color: #ffffff;
}
