/* ============================================================
   BIOAUREA - Due Diligence Ambiental
   GLASSMORPHISM LUXURY EDITION
   Accent: Amber-Gold #ff9500 → #ffc400
   ============================================================ */

@keyframes ddModalIn {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes ddPanelIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer-dd {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
@keyframes ddBarFill {
    from { width: 0; }
}

/* ===== Base Modal ===== */
.dd-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.88);
    z-index: 10000;
    overflow-y: auto;
    padding: 20px;
    align-items: flex-start;
    justify-content: center;
    padding-top: 60px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.dd-modal.active { display: flex; }

.dd-container {
    background: rgba(18, 18, 18, 0.9);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    max-width: 680px;
    width: 100%;
    border-radius: 24px;
    border: 1px solid rgba(255, 149, 0, 0.1);
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(255,255,255,0.03) inset,
        0 1px 0 rgba(255,255,255,0.05) inset;
    overflow: hidden;
    animation: ddModalIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ===== Header ===== */
.dd-header {
    background: linear-gradient(135deg, rgba(255, 149, 0, 0.06), rgba(255, 196, 0, 0.03));
    padding: 22px 28px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid rgba(255, 149, 0, 0.08);
    position: relative;
    overflow: hidden;
}
.dd-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #ff9500, #ffc400, #ff9500, transparent);
    background-size: 200% 100%;
    animation: shimmer-dd 4s ease infinite;
}

.dd-header-left { flex: 1; }
.dd-header-left h2 {
    font-size: 1.3em;
    color: #ffffff;
    font-weight: 700;
    margin: 0 0 4px 0;
    background: linear-gradient(135deg, #ffffff 30%, #ffc400 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.dd-subtitle {
    color: rgba(176, 176, 176, 0.6);
    font-size: 0.78em;
    display: block;
}

.dd-close {
    width: 32px; height: 32px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    cursor: pointer;
    color: rgba(176, 176, 176, 0.6);
    font-size: 1.1em;
    flex-shrink: 0;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}
.dd-close:hover {
    background: rgba(255, 68, 68, 0.12);
    border-color: rgba(255, 68, 68, 0.25);
    color: #ff4444;
    transform: rotate(90deg);
}

/* ===== Tabs ===== */
.dd-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
    padding: 0 24px;
}
.dd-tab {
    flex: 1;
    padding: 14px 16px;
    background: transparent;
    border: none;
    color: rgba(176, 176, 176, 0.6);
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    font-family: 'Inter', sans-serif;
}
.dd-tab::after {
    content: '';
    position: absolute;
    bottom: 0; left: 50%; right: 50%;
    height: 2px;
    background: linear-gradient(90deg, #ff9500, #ffc400);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px 2px 0 0;
}
.dd-tab:hover { color: #ff9500; }
.dd-tab.active {
    color: #ff9500;
    background: rgba(255, 149, 0, 0.04);
}
.dd-tab.active::after { left: 10%; right: 10%; }

/* ===== Tab Content ===== */
.dd-tab-panel {
    display: none;
    padding: 24px 28px;
    max-height: 72vh;
    overflow-y: auto;
}
.dd-tab-panel.active {
    display: block;
    animation: ddPanelIn 0.35s ease-out;
}
.dd-tab-panel::-webkit-scrollbar { width: 5px; }
.dd-tab-panel::-webkit-scrollbar-track { background: rgba(255,255,255,0.02); border-radius: 10px; }
.dd-tab-panel::-webkit-scrollbar-thumb { background: rgba(255,149,0,0.12); border-radius: 10px; }
.dd-tab-panel::-webkit-scrollbar-thumb:hover { background: rgba(255,149,0,0.25); }

/* ===== Form ===== */
.dd-section-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 22px;
}
.dd-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.dd-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.dd-form-label {
    color: rgba(176, 176, 176, 0.6);
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.dd-form-input,
.dd-form-select {
    width: 100%;
    padding: 11px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 149, 0, 0.12);
    border-radius: 12px;
    color: #e0e0e0;
    font-size: 0.88em;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s;
    backdrop-filter: blur(8px);
}
.dd-form-input:focus,
.dd-form-select:focus {
    outline: none;
    border-color: rgba(255, 149, 0, 0.4);
    box-shadow: 0 0 20px rgba(255, 149, 0, 0.08);
    background: rgba(255, 149, 0, 0.03);
}
.dd-form-input::placeholder { color: rgba(176, 176, 176, 0.3); }
.dd-form-hint {
    color: rgba(176, 176, 176, 0.4);
    font-size: 0.72em;
    margin-top: 3px;
}

/* ===== Buttons ===== */
.dd-btn-evaluate,
.dd-btn-compliance,
.dd-btn-liability {
    width: 100%;
    padding: 14px 16px;
    background: linear-gradient(135deg, #ff9500, #e68600);
    border: none;
    border-radius: 14px;
    color: #fff;
    font-size: 0.92em;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}
.dd-btn-evaluate::after,
.dd-btn-compliance::after,
.dd-btn-liability::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.12) 50%, transparent 60%);
    background-size: 200% 200%;
    animation: shimmer-dd 3s ease infinite;
}
.dd-btn-evaluate:hover,
.dd-btn-compliance:hover,
.dd-btn-liability:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(255, 149, 0, 0.2);
}
.dd-btn-evaluate:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== Rating Section — Glass ===== */
.dd-rating-section {
    display: flex;
    gap: 24px;
    padding: 22px;
    background: rgba(255, 149, 0, 0.03);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 149, 0, 0.1);
    border-radius: 18px;
    margin-bottom: 22px;
    align-items: center;
    position: relative;
    overflow: hidden;
}
.dd-rating-section::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255,255,255,0.04), transparent 60%);
    pointer-events: none;
}
.dd-rating-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.dd-rating-letter {
    font-size: 2.8em;
    font-weight: 900;
    min-width: 80px;
    text-align: center;
    letter-spacing: -0.03em;
    text-shadow: 0 0 30px rgba(255, 149, 0, 0.3);
}
.dd-rating-level {
    font-size: 0.75em;
    color: rgba(176, 176, 176, 0.5);
    text-align: center;
    width: 80px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.dd-rating-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.dd-rating-score,
.dd-rating-risk,
.dd-rating-vereda {
    font-size: 0.85em;
    color: rgba(176, 176, 176, 0.6);
}
.dd-rating-score span,
.dd-rating-risk span,
.dd-rating-vereda strong {
    color: #ffffff;
    font-weight: 700;
}

/* ===== Red Flags — Glass ===== */
.dd-red-flags-section {
    margin-bottom: 22px;
}
.dd-red-flags-section h3 {
    font-size: 0.88em;
    font-weight: 700;
    margin-bottom: 12px;
    color: #ff4444;
}

/* ===== Risk Factors — Glass ===== */
.dd-risk-factors { margin-bottom: 22px; }
.dd-section-title {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 700;
    margin-bottom: 14px;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dd-factors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 10px;
}
.dd-factor-card {
    background: rgba(255, 255, 255, 0.025);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}
.dd-factor-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,149,0,0.1), transparent);
}
.dd-factor-card:hover {
    background: rgba(255, 149, 0, 0.04);
    border-color: rgba(255, 149, 0, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}
.dd-factor-name {
    font-size: 0.82em;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
    margin-bottom: 10px;
}
.dd-factor-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}
.dd-factor-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.dd-factor-bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer-dd 2s ease infinite;
    background-size: 200% 100%;
}
.dd-factor-score {
    font-size: 0.75em;
    color: rgba(176, 176, 176, 0.5);
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

/* ===== Charts — Glass ===== */
.dd-chart-container {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    padding: 20px;
    margin-bottom: 22px;
    overflow: hidden;
    position: relative;
}
.dd-chart-container::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,149,0,0.15), transparent);
}
.dd-chart-container canvas {
    width: 100%;
    height: auto;
}

/* ===== Carbon Liability — Glass ===== */
.dd-liability-section {
    background: rgba(255, 149, 0, 0.03);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 20px;
    border: 1px solid rgba(255, 149, 0, 0.1);
    border-radius: 18px;
    margin-bottom: 22px;
    position: relative;
    overflow: hidden;
}
.dd-liability-section::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255,255,255,0.03), transparent 60%);
    pointer-events: none;
}
.dd-liability-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 14px;
}
.dd-liability-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(8px);
    padding: 16px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 149, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: center;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}
.dd-liability-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,149,0,0.1), transparent);
}
.dd-liability-card:hover {
    background: rgba(255,255,255,0.05);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.dd-liability-label {
    font-size: 0.68em;
    color: rgba(176, 176, 176, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}
.dd-liability-value {
    font-size: 1.3em;
    color: #ffc400;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}
.dd-liability-unit {
    font-size: 0.7em;
    color: rgba(176, 176, 176, 0.4);
}

/* ===== Recommendations — Glass ===== */
.dd-recommendations { margin-top: 22px; }
.dd-recs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.dd-rec-item {
    background: rgba(255, 255, 255, 0.025);
    backdrop-filter: blur(8px);
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-left: 3px solid rgba(255, 149, 0, 0.4);
    color: rgba(176, 176, 176, 0.8);
    font-size: 0.85em;
    line-height: 1.5;
    transition: all 0.25s;
}
.dd-rec-item:hover {
    background: rgba(255, 149, 0, 0.04);
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.dd-rec-icon {
    color: #ffc400;
    font-weight: 700;
    margin-right: 8px;
}

/* ===== Compliance — Glass ===== */
.dd-compliance-search {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 22px;
}
.dd-search-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
}
.dd-compliance-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 22px;
    padding: 18px;
    background: rgba(255, 149, 0, 0.03);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 149, 0, 0.1);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}
.dd-compliance-summary::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,149,0,0.15), transparent);
}
.dd-summary-stat {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: center;
}
.dd-stat-label {
    font-size: 0.68em;
    color: rgba(176, 176, 176, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}
.dd-stat-value {
    font-size: 1.5em;
    color: #ffc400;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* ===== Frameworks — Glass ===== */
.dd-frameworks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.dd-framework-card {
    background: rgba(255, 255, 255, 0.025);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}
.dd-framework-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,149,0,0.08), transparent);
}
.dd-framework-card:hover {
    background: rgba(255, 149, 0, 0.04);
    border-color: rgba(255, 149, 0, 0.15);
    transform: translateX(4px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.dd-frame-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.dd-frame-icon {
    font-size: 1.3em;
    font-weight: 700;
    flex-shrink: 0;
}
.dd-frame-title {
    font-weight: 700;
    color: #ffffff;
    font-size: 0.88em;
}
.dd-frame-ref {
    font-size: 0.72em;
    color: rgba(176, 176, 176, 0.4);
    margin-bottom: 8px;
}
.dd-frame-evidence {
    font-size: 0.82em;
    color: rgba(176, 176, 176, 0.6);
    margin-bottom: 10px;
    line-height: 1.5;
}
.dd-frame-recommendation {
    font-size: 0.8em;
    color: rgba(176, 176, 176, 0.5);
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    line-height: 1.5;
}

/* ===== Liability Detail Table — Glass ===== */
.dd-liability-table {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 149, 0, 0.08);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 18px;
}
.dd-liability-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 0.8fr;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    align-items: center;
}
.dd-liability-row:last-child { border-bottom: none; }
.dd-liability-row-loss { background: rgba(255, 149, 0, 0.04); }
.dd-liability-row-total {
    background: rgba(255, 149, 0, 0.08);
    font-weight: 700;
}
.dd-liability-cell-label {
    color: rgba(176, 176, 176, 0.6);
    font-size: 0.82em;
}
.dd-liability-cell-value {
    color: #ffc400;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    font-size: 1em;
}
.dd-liability-cell-unit {
    color: rgba(176, 176, 176, 0.4);
    font-size: 0.72em;
    text-align: right;
}
.dd-liability-note {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(8px);
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-left: 3px solid rgba(255, 149, 0, 0.4);
    border-radius: 12px;
    color: rgba(176, 176, 176, 0.5);
    font-size: 0.82em;
    line-height: 1.6;
}

/* ===== Export Button ===== */
.dd-btn-export {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--text-primary, #fff);
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Inter', sans-serif;
    margin-top: 12px;
}
.dd-btn-export:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

/* ===== Spinner ===== */
.dd-spinner {
    width: 44px; height: 44px;
    border: 3px solid rgba(255, 149, 0, 0.1);
    border-top-color: #ff9500;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 30px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .dd-container { max-width: 95vw; border-radius: 16px; }
    .dd-form-row, .dd-factors-grid { grid-template-columns: 1fr; }
    .dd-tab { font-size: 0.78em; padding: 12px 14px; }
    .dd-tab-panel { padding: 18px 20px; }
    .dd-rating-section { flex-direction: column; text-align: center; }
    .dd-liability-cards { grid-template-columns: repeat(2, 1fr); }
    .dd-compliance-summary { grid-template-columns: repeat(3, 1fr); }
    .dd-liability-row { grid-template-columns: 1fr 1fr; }
    .dd-liability-cell-unit { grid-column: 1 / -1; text-align: left; }
}
@media (max-width: 480px) {
    .dd-modal { padding: 10px; padding-top: 40px; }
    .dd-container { border-radius: 16px; }
    .dd-header { padding: 16px 18px; }
    .dd-header-left h2 { font-size: 1.1em; }
    .dd-tab-panel { padding: 14px 16px; }
    .dd-rating-section { padding: 16px; gap: 14px; }
    .dd-factors-grid { grid-template-columns: 1fr; }
    .dd-liability-cards { grid-template-columns: 1fr; }
    .dd-compliance-summary { grid-template-columns: 1fr; }
    .dd-search-row { grid-template-columns: 1fr; }
}
