/* -----------------------------------------------------------
   Rani Nexus - Frontend UI Styles
   Premium dark interface for AI Solicitor + Due Diligence
------------------------------------------------------------ */

/* ============ SHARED CONTAINER ============ */

.rnx-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #f2f4f7;
}

.rnx-card {
    background: #111217;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 25px;
}

/* Headings */
.rnx-title,
.rnx-container h2,
.rnx-container h3 {
    color: #ffffff;
    margin-top: 0;
}

/* Forms */
.rnx-form {
    margin-top: 10px;
}

/* FIELD LABELS */
.rnx-label {
    display: block;
    margin-bottom: 6px;
    font-size: 15px;
    font-weight: 600;
    color: #d9dce3;
}

/* Inputs */
.rnx-input,
.rnx-textarea,
.rnx-select {
    width: 100%;
    padding: 12px;
    background: #0f1117;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: #ffffff;
    margin-bottom: 15px;
    font-size: 16px;
}

.rnx-input::placeholder,
.rnx-textarea::placeholder {
    color: rgba(255,255,255,0.4);
}

.rnx-textarea {
    height: 160px;
    resize: vertical;
}

/* File upload box */
.rnx-upload-box {
    background: #16171d;
    border: 1px dashed rgba(255,255,255,0.3);
    padding: 18px;
    border-radius: 8px;
    text-align: center;
    cursor: default;
    color: #dfe3ea;
    margin-bottom: 15px;
}

/* -----------------------------------------------------------
   PRIMARY / SECONDARY BUTTONS
------------------------------------------------------------ */

/* Base: any button in our container (overrides theme styles) */
.rnx-container button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border-radius: 8px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.25s ease;
    background: #4f66ff;
    color: #ffffff;
}

/* Hover only when enabled */
.rnx-container button:not(:disabled):hover {
    background: #3d52e0;
}

/* Disabled state */
.rnx-container button:disabled {
    opacity: 0.7;
    cursor: default;
}

/* Explicit primary (Run Analysis) */
.rnx-button-primary {
    background: #4f66ff;
    color: #ffffff;
}

/* Secondary buttons: Copy Summary / Download PDF */
.rnx-button-secondary {
    margin-left: 8px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.25);
    color: #f2f4f7;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 16px;
}

.rnx-button-secondary:not(:disabled):hover {
    background: rgba(255,255,255,0.06);
}

.rnx-button-secondary:disabled {
    opacity: 0.45;
    cursor: default;
}

/* Spinner inside primary */
.rnx-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #ffffff;
    animation: rnx-spin 0.7s linear infinite;
}

@keyframes rnx-spin {
    to { transform: rotate(360deg); }
}

/* -----------------------------------------------------------
   RESULTS PANEL (AI + new DD reports)
------------------------------------------------------------ */

.rnx-card-result {
    margin-top: 10px;
    background: #14151b;
}

.rnx-card-result h3 {
    color: #ffffff;
    margin-top: 0;
    margin-bottom: 12px;
}

.rnx-output-placeholder {
    color: #d4d6db;
}

/* Root container that JS fills with HTML */
.rnx-output-content {
    background: #1e1f24;
    color: #f1f3f7;
    padding: 20px;
    border-radius: 8px;
    font-size: 16px;
    line-height: 1.7;
    display: none; /* JS sets to block */
    margin-top: 10px;
}

/* Keep text readable inside the results area */
.rnx-output-content,
.rnx-output-content * {
    color: #f1f3f7 !important;
}

/* Our custom report block */
.rnx-dd-report {
    background: #111217;
    border-radius: 8px;
    padding: 16px 16px 4px 16px;
}

/* Header (title line) */
.rnx-dd-report-header {
    display: inline-block;
    padding: 6px 10px;
    margin-bottom: 12px;
    background: #ff8a00;
    color: #ffffff !important;
    font-weight: 700;
    font-size: 18px;
    border-radius: 6px;
}

/* Body text */
.rnx-dd-report-body p {
    margin: 0 0 10px 0;
    color: #f1f3f7 !important;
}

/* Optional loading skeleton (the "Running analysis..." cards) */
.rnx-loading-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.rnx-loading-card {
    flex: 1;
    padding: 12px 14px;
    border-radius: 8px;
    background: #1b1c22 !important;
    color: #f1f3f7 !important;
    font-size: 14px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* -----------------------------------------------------------
   CASES DASHBOARD STYLING
------------------------------------------------------------ */

.rnx-table {
    width: 100%;
    margin-top: 20px;
    border-collapse: collapse;
    display: block;
}

.rnx-table-header,
.rnx-table-row {
    display: grid;
    grid-template-columns: 1.2fr 1.6fr 1fr 1fr 1fr 1fr;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    align-items: center;
    color: #e8eaf0;
}

.rnx-table-header {
    font-weight: bold;
    color: #ffffff;
    border-bottom: 2px solid rgba(255,255,255,0.2);
    margin-bottom: 8px;
}

.rnx-table-row:hover {
    background: rgba(255,255,255,0.03);
}

/* Dashboard buttons */
.rnx-button,
.rnx-button-small,
.rnx-button-danger {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: 0.2s ease;
}

.rnx-button {
    background: #4f66ff;
    color: #fff;
}

.rnx-button:hover {
    background: #3e52d9;
}

.rnx-button-small {
    background: #4f66ff;
    color: #fff;
    padding: 6px 10px;
    font-size: 13px;
}

.rnx-button-small:hover {
    background: #3d52d9;
}

.rnx-button-danger {
    background: #ff4f4f;
    color: white;
}

.rnx-button-danger:hover {
    background: #d63d3d;
}

/* Back link */
.rnx-link-back {
    display: inline-block;
    margin-bottom: 15px;
    color: #8892ff;
    text-decoration: none;
    font-weight: 600;
}

.rnx-link-back:hover {
    color: #b2b8ff;
}

/* Alerts */
.rnx-alert-success {
    background: rgba(0, 255, 0, 0.12);
    color: #b4ffb4;
    padding: 12px 14px;
    border-radius: 6px;
    margin-bottom: 15px;
}

/* Meta grid (single case info) */
.rnx-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
    color: #dfe2ea;
}

.rnx-section {
    margin-top: 20px;
}

.rnx-subheading {
    color: #ffffff;
    margin-bottom: 10px;
}

/* Documents and reports lists */
.rnx-list-documents li,
.rnx-list-reports li {
    margin-bottom: 8px;
    background: #1b1d24;
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.08);
    color: #e4e6eb;
}

/* Actions cell */
.rnx-table-actions {
    display: flex;
    gap: 10px;
}

/* Mobile adjustments */
@media (max-width: 768px) {

    .rnx-table-header,
    .rnx-table-row {
        grid-template-columns: 1fr 1fr;
        grid-row-gap: 6px;
        padding: 12px;
    }

    .rnx-table-actions {
        grid-column: 1 / 3;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .rnx-meta-grid {
        grid-template-columns: 1fr;
    }
}

/* ===========================================================
   LEGACY DUE DILIGENCE UI (rn-dd-app)
   Theme-proof styling that matches AI Solicitor
   (This only touches the old rn-* markup, NOT AI Solicitor.)
=========================================================== */

#rn-dd-app {
    max-width: 1100px;
    margin: 0 auto 40px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #f2f4f7;
}

/* Grid layout for fields */
#rn-dd-app .rn-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 24px;
    row-gap: 16px;
}

/* Type, Brief, Upload docs = full width */
#rn-dd-app .rn-grid .rn-field:nth-child(1),
#rn-dd-app .rn-grid .rn-field:nth-child(2),
#rn-dd-app .rn-grid .rn-field:nth-child(6) {
    grid-column: 1 / -1;
}

/* Labels – strong, readable, not faint */
#rn-dd-app label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #e5e9ff !important;
}

/* Inputs / selects / textareas / file input */
#rn-dd-app select,
#rn-dd-app input[type="text"],
#rn-dd-app textarea,
#rn-dd-app input[type="file"] {
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.18) !important;
    background: #0f1117 !important;
    color: #f8f9ff !important;
    font-size: 15px;
    box-shadow: none !important;
}

#rn-dd-app textarea {
    min-height: 150px;
    resize: vertical;
}

#rn-dd-app select:focus,
#rn-dd-app input[type="text"]:focus,
#rn-dd-app textarea:focus {
    outline: none;
    border-color: #4f66ff !important;
    box-shadow: 0 0 0 1px rgba(79,102,255,0.9);
}

/* Action buttons row */
#rn-dd-app .rn-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

/* Primary / secondary buttons */
#rn-dd-app .rn-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 170px;
    padding: 11px 20px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    background: #4f66ff;
    color: #ffffff;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

#rn-dd-app .rn-btn:hover {
    background: #3d52e0;
    box-shadow: 0 10px 22px rgba(0,0,0,0.45);
    transform: translateY(-1px);
}

#rn-dd-app .rn-btn.rn-outline {
    background: transparent;
    border-color: rgba(255,255,255,0.4);
    color: #f2f4f7;
}

#rn-dd-app .rn-btn.rn-outline:hover {
    background: rgba(255,255,255,0.06);
}

/* Tabs / Full report bar */
#rn-dd-app .rn-tabs {
    margin-top: 24px;
    border-bottom: 1px solid rgba(255,255,255,0.16);
}

#rn-dd-app .rn-tab {
    display: inline-block;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    color: #cfd5ff;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

#rn-dd-app .rn-tab.rn-active {
    color: #ffffff;
    border-color: #4f66ff;
}

/* Full report panel */
#rn-dd-app #rn-full-report {
    margin-top: 14px;
    background: #111217;
    border-radius: 10px;
    padding: 14px 18px;
    border: 1px solid rgba(255,255,255,0.12);
    color: #f2f4f7;
    font-size: 15px;
}

#rn-dd-app #rn-full-report p {
    margin: 0;
}

/* Mobile tweaks */
@media (max-width: 900px) {
    #rn-dd-app {
        padding: 0 10px;
    }

    #rn-dd-app .rn-grid {
        grid-template-columns: 1fr;
    }
}
