/* ========================================
   REPORTING PAGE — Lemonade Pink/Black
   ======================================== */

/* Page Wrapper - Standalone mode */
.rp-wrapper {
    width: 100%;
    height: calc(100vh - 60px);
    overflow: hidden;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Embedded mode — no height constraint, flows within parent */
.rp-wrapper.rp-embedded {
    height: auto;
    overflow: visible;
    background: transparent;
}

.rp-wrapper.rp-embedded .rp-container {
    overflow: visible;
}

.rp-wrapper.rp-embedded .rp-content {
    padding: 0;
}

.rp-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow-y: auto;
    position: relative;
    z-index: var(--z-base);
}

.rp-container::-webkit-scrollbar {
    width: 4px;
}

.rp-container::-webkit-scrollbar-track {
    background: transparent;
}

.rp-container::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: 2px;
}

/* ========================================
   LOADING SPINNER
   ======================================== */

.rp-spinner-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-light);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

.rp-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.rp-spinner-ring {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-primary);
    border-top-color: var(--accent-primary);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

.rp-spinner p {
    color: var(--text-body);
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    letter-spacing: var(--tracking-wide);
}

/* Custom Modern Loader */
.rp-loader-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-dark);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    animation: fadeIn var(--transition-base) ease-out;
}

.rp-loader {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rp-loader-ring {
    position: absolute;
    border: 3px solid transparent;
    border-radius: var(--radius-full);
    border-top-color: var(--accent-primary);
    animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.rp-loader-ring:nth-child(1) {
    width: 90px;
    height: 90px;
    animation-delay: -0.45s;
}

.rp-loader-ring:nth-child(2) {
    width: 70px;
    height: 70px;
    animation-delay: -0.3s;
    border-top-color: var(--accent-secondary);
}

.rp-loader-ring:nth-child(3) {
    width: 50px;
    height: 50px;
    animation-delay: -0.15s;
    border-top-color: var(--info);
}

.rp-loader-text {
    margin-top: 140px;
    color: white;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    letter-spacing: var(--tracking-wider);
    animation: rp-pulse 1.5s ease-in-out infinite;
}

/* ========================================
   HEADER SECTION — Standalone mode
   ======================================== */

.rp-header {
    background: var(--surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin: 20px 24px 0 24px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.rp-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent-primary);
}

.rp-header-content {
    display: flex;
    align-items: center;
    gap: 14px;
}

.rp-header-icon {
    width: 42px;
    height: 42px;
    background: var(--accent-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--accent-primary);
}

.rp-header-text {
    flex: 1;
}

.rp-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.rp-subtitle {
    margin: 2px 0 0 0;
    font-size: var(--text-sm);
    color: var(--text-muted);
    font-weight: var(--font-regular);
}

/* ========================================
   CONTENT AREA
   ======================================== */

.rp-content {
    padding: 16px 24px 24px 24px;
}

/* ========================================
   REPORT SECTIONS
   ======================================== */

.rp-section {
    background: var(--surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.rp-section:hover {
    box-shadow: var(--shadow-md);
}

.rp-section-title {
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-primary);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0;
}

.rp-section-title i {
    color: var(--accent-primary);
    font-size: 15px;
}

/* Dark mode — proper surface layering */
[data-theme="dark"] .rp-section {
    background: var(--surface);
    border-color: var(--border-primary);
}

/* ========================================
   REPORT CARDS GRID
   ======================================== */

.rp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.rp-card {
    background: var(--surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    padding: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

/* Pink left accent on hover */
.rp-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent-primary);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.rp-card:hover::before {
    opacity: 1;
}

.rp-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Dark mode cards — inset background for depth */
[data-theme="dark"] .rp-card {
    background: var(--surface-inset);
    border-color: var(--border-primary);
}

[data-theme="dark"] .rp-card:hover {
    background: var(--surface);
    border-color: var(--border-secondary);
}

.rp-card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 18px;
    flex-shrink: 0;
    transition: all 0.2s ease;
    background: var(--accent-light);
    color: var(--accent-primary);
}

/* Color Variants for Icons — Light mode */
.rp-card-blue .rp-card-icon {
    background: rgba(42, 118, 228, 0.1);
    color: #2A76E4;
}
.rp-card-orange .rp-card-icon {
    background: rgba(255, 176, 28, 0.1);
    color: #FFB01C;
}
.rp-card-green .rp-card-icon {
    background: rgba(42, 213, 189, 0.1);
    color: #2AD5BD;
}
.rp-card-red .rp-card-icon {
    background: rgba(247, 39, 74, 0.1);
    color: #F7274A;
}
.rp-card-purple .rp-card-icon {
    background: rgba(124, 58, 237, 0.1);
    color: #7C3AED;
}
.rp-card-teal .rp-card-icon {
    background: rgba(255, 0, 131, 0.1);
    color: #ff0083;
}
.rp-card-indigo .rp-card-icon {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

/* Color Variants — Dark mode (brighter, higher opacity bg) */
[data-theme="dark"] .rp-card-blue .rp-card-icon {
    background: rgba(74, 144, 226, 0.16);
    color: #6aacf5;
}
[data-theme="dark"] .rp-card-orange .rp-card-icon {
    background: rgba(255, 176, 28, 0.16);
    color: #FFD166;
}
[data-theme="dark"] .rp-card-green .rp-card-icon {
    background: rgba(42, 213, 189, 0.16);
    color: #4de8d3;
}
[data-theme="dark"] .rp-card-red .rp-card-icon {
    background: rgba(248, 49, 87, 0.16);
    color: #FF6B8A;
}
[data-theme="dark"] .rp-card-purple .rp-card-icon {
    background: rgba(196, 181, 253, 0.16);
    color: #C4B5FD;
}
[data-theme="dark"] .rp-card-teal .rp-card-icon {
    background: rgba(255, 0, 131, 0.16);
    color: #ff3da0;
}
[data-theme="dark"] .rp-card-indigo .rp-card-icon {
    background: rgba(129, 140, 248, 0.16);
    color: #A5B4FC;
}

.rp-card-content {
    flex: 1;
    min-width: 0;
}

.rp-card-title {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.rp-card:hover .rp-card-title {
    color: var(--accent-primary);
}

.rp-card-desc {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
    margin: 0;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1200px) {
    .rp-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 768px) {
    .rp-header {
        padding: 16px;
        margin: 12px 16px 0 16px;
    }

    .rp-title {
        font-size: 18px;
    }

    .rp-content {
        padding: 12px 16px;
    }

    .rp-section {
        padding: 16px;
        margin-bottom: 14px;
    }

    .rp-section-title {
        font-size: 14px;
    }

    .rp-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .rp-card {
        padding: 14px;
    }

    .rp-card-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .rp-header-content {
        gap: 10px;
    }

    .rp-header-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .rp-card-title {
        font-size: 13px;
    }

    .rp-card-desc {
        font-size: 11px;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes rp-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   SFDIALOG STYLING (SCOPED TO REPORTING PAGE)
   ======================================== */

/* Dialog Container */
.rp-dialog.e-dialog.e-dlg-modal {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
}

.rp-dialog.e-dialog {
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-xl) !important;
    border: none !important;
    font-family: var(--font-sans) !important;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
}

/* Dialog Overlay/Backdrop */
.e-dlg-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 1000 !important;
}

/* Dialog Target Container */
.e-dlg-target.e-dlg-parent {
    position: relative !important;
}

.rp-dialog .e-dlg-header-content {
    background: var(--bg-secondary) !important;
    padding: 20px 24px !important;
    border-bottom: 1px solid var(--border-primary) !important;
    position: relative;
}

.rp-dialog .e-dlg-header-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-primary);
}

.rp-dialog .e-dlg-header {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    letter-spacing: -0.01em !important;
}

.rp-dialog .e-dlg-closeicon-btn {
    color: var(--text-muted) !important;
    background: var(--surface) !important;
    border: 1px solid var(--border-primary) !important;
    border-radius: var(--radius-sm) !important;
    width: 32px !important;
    height: 32px !important;
}

.rp-dialog .e-dlg-closeicon-btn:hover {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

.rp-dialog .e-dlg-content {
    padding: 20px 24px !important;
    background: var(--surface) !important;
}

.rp-dialog .e-footer-content {
    padding: 0 !important;
    background: var(--bg-secondary) !important;
}

.rp-dialog-footer {
    display: flex;
    gap: var(--space-md);
    padding: 16px 24px;
    border-top: 1px solid var(--border-primary);
    background: var(--bg-secondary);
}

/* ========================================
   CUSTOM FORM COMPONENTS (FOR DIALOGS)
   ======================================== */

/* Form Groups */
.rp-form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.rp-form-group label {
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.rp-form-grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}

.rp-form-grid-three {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-lg);
}

/* Custom Inputs */
.rp-input,
.rp-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--text-body);
    background: var(--surface);
    transition: all 0.15s ease;
}

.rp-input:focus,
.rp-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--focus-ring);
}

.rp-input::placeholder {
    color: var(--text-muted);
}

.rp-input:disabled,
.rp-select:disabled {
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: not-allowed;
}

.rp-input:read-only {
    background: var(--bg-secondary);
    cursor: default;
}

/* Custom Buttons */
.rp-btn {
    background: var(--surface);
    color: var(--text-body);
    border: 1px solid var(--border-primary);
    border-radius: 5px;
    padding: 10px 22px;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: var(--text-sm);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.rp-btn:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.rp-btn-primary {
    background: var(--accent-primary);
    color: white;
    border-color: transparent;
    box-shadow: rgba(255, 0, 131, 0.3) 0px 6px 20px -6px;
}

.rp-btn-primary:hover {
    background: var(--accent-secondary);
    box-shadow: rgba(255, 0, 131, 0.4) 0px 8px 24px -6px;
    transform: translateY(-1px);
}

.rp-btn-secondary {
    background: var(--surface);
    color: var(--text-body);
    border-color: var(--border-primary);
}

.rp-btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
}

.rp-btn-danger {
    background: #F7274A;
    color: white;
    border-color: transparent;
}

.rp-btn-danger:hover {
    background: #dc2040;
    box-shadow: 0 4px 16px rgba(247, 39, 74, 0.2);
}

.rp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.rp-btn-block {
    width: 100%;
}

/* Radio Button Group */
.rp-radio-group {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
}

.rp-radio-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
}

.rp-radio-item input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-primary);
}

.rp-radio-item label {
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--text-body);
    cursor: pointer;
    margin: 0;
}

/* Form Actions */
.rp-form-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-primary);
}

/* Dialog Content Layouts */
.rp-dialog-split {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-xl);
    height: 100%;
}

.rp-dialog-column {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* Section Headers in Dialogs */
.rp-section-label {
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-sm);
}
