/* ===== BUSINESS EPIC STYLES - ORGANIZED & OPTIMIZED ===== */

/* ========================================
   1. PROGRESS BAR SYSTEM
   ======================================== */

.epic-progress-container {
    background: rgba(26, 26, 46, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.epic-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.epic-progress-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.epic-progress-percentage {
    font-size: 1.5rem;
    font-weight: 900;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.epic-progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.epic-progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 6px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.epic-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.epic-progress-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.epic-progress-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.stat-dot.completed { background: var(--success); }
.stat-dot.in-progress { background: var(--warning); }
.stat-dot.pending { background: var(--text-secondary); }


/* ========================================
   2. PHASE CARDS
   ======================================== */

.phase-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.phase-card {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.8) 0%, rgba(26, 26, 46, 0.4) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.phase-card::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--primary-gradient);
    opacity: 0;
    border-radius: 12px;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.phase-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
}

.phase-card:hover::after {
    opacity: 0.15;
}

.phase-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.phase-number {
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.2rem;
}

.phase-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.phase-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
}

.phase-goal {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
}


/* ========================================
   3. FLOW DIAGRAMS
   ======================================== */

.flow-diagram {
    background: rgba(26, 26, 46, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    overflow-x: auto;
}

.flow-steps {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: fit-content;
}

.flow-step {
    background: rgba(102, 126, 234, 0.1);
    border: 2px solid var(--accent-color);
    border-radius: 10px;
    padding: 1rem 1.5rem;
    min-width: 150px;
    text-align: center;
}

.flow-arrow {
    color: var(--accent-color);
    font-size: 2rem;
    flex-shrink: 0;
}


/* ========================================
   4. STORY COMPONENTS
   ======================================== */

.story-content-wrapper {
    background: rgba(26, 26, 46, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    text-align: right;
}

.story-detail {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.6) 0%, rgba(26, 26, 46, 0.3) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
}

.story-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.story-meta {
    display: flex;
    gap: 2rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.meta-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.meta-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}


/* ========================================
   5. TYPOGRAPHY & TEXT STYLES
   ======================================== */

.section-content h3,
.story-content-wrapper h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 2rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.section-content h4,
.story-content-wrapper h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-color);
    margin: 1.5rem 0 0.8rem 0;
}

.info-card-content h4 {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-card-content > h4:first-of-type {
    margin-top: 0.5rem;
}

.story-content-wrapper p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin: 1rem 0;
}

.story-content-wrapper strong,
.info-card strong,
ul li strong {
    color: var(--text-primary);
    font-weight: 600;
}

.info-card p {
    margin: 0.8rem 0;
    line-height: 1.8;
}

.info-card-content p {
    font-size: 1rem;
    line-height: 1.8;
}

.info-card-content > p:first-child {
    margin-top: 0;
}

.info-card-content > p:last-child {
    margin-bottom: 0;
}

.warning-box > p,
.highlight-box > p {
    margin: 0.8rem 0;
    line-height: 1.8;
}

.warning-box > p:first-of-type {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 0;
}

.highlight-box > p:first-of-type {
    margin-top: 0;
    font-size: 1.05rem;
}


/* ========================================
   6. LISTS
   ======================================== */

.info-card ul {
    margin: 1rem 0;
    padding-right: 2rem;
    list-style: disc;
    color: var(--text-secondary);
}

.info-card ul li {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.info-card ul ul {
    margin-top: 0.5rem;
    padding-right: 1.5rem;
}

.story-content-wrapper ul:not(.feature-list):not(.task-list):not(.action-checklist) {
    list-style: disc;
    padding-right: 2rem;
    margin: 1rem 0;
    color: var(--text-secondary);
}

.story-content-wrapper ul:not(.feature-list):not(.task-list):not(.action-checklist) li {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.warning-box ul:not(.feature-list) {
    list-style: disc;
    padding-right: 2rem;
    margin: 1rem 0;
}

.warning-box ul:not(.feature-list) li {
    margin: 0.5rem 0;
}

.task-list {
    list-style: none;
    padding: 0;
}

.task-list li {
    padding: 0.6rem 0;
    padding-right: 1.5rem;
    position: relative;
    color: var(--text-secondary);
}

.task-list li::before {
    content: '◄';
    position: absolute;
    right: 0;
    color: var(--accent-color);
    font-weight: bold;
}


/* ========================================
   7. TABLES
   ======================================== */

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background: rgba(26, 26, 46, 0.3);
    border-radius: 8px;
    overflow: hidden;
}

.comparison-table th {
    background: rgba(102, 126, 234, 0.15);
    color: var(--accent-color);
    padding: 1rem;
    text-align: right;
    font-weight: 700;
    border-bottom: 2px solid var(--border-color);
}

.comparison-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    line-height: 1.6;
    vertical-align: top;
}

.comparison-table tr:last-child td {
    border-bottom: none;
}

.comparison-table tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

.comparison-table th[style*="width: 30%"] {
    width: 30%;
}

/* Warning Box Table Specific */
.warning-box table {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
}

.warning-box .comparison-table {
    background: rgba(26, 26, 46, 0.4);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.warning-box .comparison-table th {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border-bottom: 2px solid rgba(239, 68, 68, 0.3);
}

.warning-box .comparison-table td {
    border-bottom: 1px solid rgba(239, 68, 68, 0.15);
}

.warning-box .comparison-table td strong {
    color: var(--text-primary);
    font-weight: 600;
    display: block;
    margin-bottom: 0.3rem;
}

.warning-box .comparison-table tr:hover {
    background: rgba(239, 68, 68, 0.08);
}

.info-card .comparison-table {
    margin: 1.5rem 0;
}

.info-card table {
    width: 100%;
    margin: 1rem 0;
}

.info-card thead th {
    text-align: right;
    padding: 0.8rem;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.info-card tbody td {
    padding: 0.8rem;
    border-bottom: 1px solid var(--border-color);
}

/* Real Risks Board */
.real-risks-box {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: linear-gradient(160deg, rgba(239, 68, 68, 0.12) 0%, rgba(26, 26, 46, 0.55) 100%);
}

.real-risks-box::before {
    content: "";
    position: absolute;
    top: -140px;
    left: -100px;
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.2) 0%, transparent 72%);
    pointer-events: none;
}

.real-risks-subtitle {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 1.2rem;
}

.real-risks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.real-risk-card {
    background: linear-gradient(145deg, rgba(26, 26, 46, 0.9) 0%, rgba(26, 26, 46, 0.65) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 1rem;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.real-risk-card:hover {
    transform: translateY(-3px);
    border-color: rgba(239, 68, 68, 0.45);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.real-risk-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.real-risk-head h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 700;
}

.risk-level {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.risk-level.risk-critical {
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.45);
}

.risk-level.risk-high {
    background: rgba(245, 158, 11, 0.16);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.risk-level.risk-medium {
    background: rgba(59, 130, 246, 0.18);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.45);
}

.real-risk-body {
    color: var(--text-secondary);
    font-size: 0.93rem;
    line-height: 1.7;
    margin: 0 0 0.9rem;
}

.real-risk-meta {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.real-risk-meta span {
    display: block;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.55;
}

.real-risk-meta strong {
    color: var(--text-primary);
    font-weight: 700;
}

.real-risks-footer {
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px dashed rgba(239, 68, 68, 0.35);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.real-risks-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fecaca;
    font-size: 0.8rem;
}


/* ========================================
   8. ARCHITECTURE COMPONENTS
   ======================================== */

.arch-layer {
    background: rgba(26, 26, 46, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.arch-layer-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.arch-layer p,
.arch-layer-title + p {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.arch-components {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.arch-component {
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 6px;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.info-card .arch-layer {
    margin: 1rem 0;
}

.info-card .arch-layer:first-of-type {
    margin-top: 1.5rem;
}


/* ========================================
   9. STATS & METRICS
   ======================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.8) 0%, rgba(26, 26, 46, 0.4) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
}

.stat-card > div {
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 900;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-size: 0.95rem;
}

/* Info Card Stats */
.info-card .stats-grid {
    margin: 1.5rem 0;
}

.info-card .stat-card {
    background: rgba(102, 126, 234, 0.08);
}

.info-card .stat-card .stat-label {
    color: var(--text-secondary);
}

.info-card .stat-card .stat-number {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Highlight Box Stats - KPIs */
.highlight-box .stats-grid {
    margin: 1.5rem 0;
}

.highlight-box .stats-grid .stat-card {
    min-height: 120px;
    padding: 1.5rem 1rem;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.9) 0%, rgba(26, 26, 46, 0.6) 100%);
}

.highlight-box .stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.highlight-box .stat-card div:not(.stat-label):not(.stat-number) {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin-top: 0.5rem;
}

.highlight-box .stats-grid .stat-card .stat-number {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
}

.highlight-box .stats-grid .stat-card .stat-label {
    font-size: 0.95rem;
    text-transform: none;
    line-height: 1.5;
}

/* Inline Style Override */
div[style*="margin-top: 0.5rem; color: var(--text-primary)"] {
    margin-top: 0.5rem !important;
    color: var(--text-primary) !important;
}


/* ========================================
   10. QUOTE BLOCKS
   ======================================== */

.quote-block {
    border-right: 4px solid var(--accent-color);
    padding: 1.5rem 2rem;
    margin: 2rem 0;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 0 8px 8px 0;
    font-size: 1.05rem;
    font-style: italic;
    color: var(--text-secondary);
    line-height: 1.8;
}

.quote-block strong {
    color: var(--accent-color);
    font-weight: 700;
}

.quote-block br {
    display: block;
    content: "";
    margin-bottom: 0.5rem;
}

.quote-block br + br {
    display: block;
    margin-bottom: 0.5rem;
}

div[style*="margin-top: 3rem"].quote-block {
    margin-top: 3rem;
    padding: 2rem;
    font-size: 1.1rem;
}

.info-card .quote-block,
.highlight-box .quote-block {
    margin: 1.5rem 0;
}

.quote-block + p,
.quote-block + ul {
    margin-top: 1rem;
}


/* ========================================
   11. TASK BREAKDOWN
   ======================================== */

.task-section {
    margin: 2rem 0;
}

.task-category {
    background: rgba(102, 126, 234, 0.05);
    border-left: 3px solid var(--accent-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.task-category-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}


/* ========================================
   12. BADGES & LABELS
   ======================================== */

.priority-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.priority-critical {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.priority-high {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.priority-medium {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.4);
}


/* ========================================
   13. LOADING & ERROR STATES
   ======================================== */

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    gap: 1rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(102, 126, 234, 0.1);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.error-container {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    margin: 2rem 0;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.error-message {
    color: var(--danger);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.error-details {
    color: var(--text-secondary);
    font-size: 0.9rem;
}


/* ========================================
   14. SPACING & LAYOUT
   ======================================== */

.highlight-box + .info-card,
.info-card + .info-card,
.warning-box + .info-card,
.info-card + .warning-box,
.info-card + .highlight-box,
.warning-box + .info-card,
.info-card + .quote-block,
.quote-block + .warning-box,
.warning-box + .highlight-box {
    margin-top: 2rem;
}

h3 + .phase-cards-grid {
    margin-top: 2rem;
}

.section-content .flow-diagram {
    margin: 2rem 0;
}

.info-card-content h4 + .feature-list {
    margin-top: 1rem;
}

.info-card > *:last-child,
.highlight-box > *:last-child,
.warning-box > *:last-child {
    margin-bottom: 0;
}

.info-card > *:first-child,
.highlight-box > *:first-child,
.warning-box > *:first-child {
    margin-top: 0;
}

.info-card-title + .info-card-content {
    padding-top: 0.5rem;
}


/* ========================================
   15. COLOR OVERRIDES
   ======================================== */

h4[style*="color: var(--success)"] {
    color: var(--success) !important;
    display: flex;
    align-items: center;
}

h4[style*="color: var(--danger)"] {
    color: var(--danger) !important;
    display: flex;
    align-items: center;
}

h4[style*="margin: 2rem 0 1rem"] {
    margin: 2rem 0 1rem !important;
}

h4[style*="margin-bottom: 1rem"] {
    margin-bottom: 1rem !important;
}


/* ========================================
   16. RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1200px) {
    .highlight-box .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    /* Phase Cards */
    .phase-cards-grid {
        grid-template-columns: 1fr;
    }
    
    /* Flow Diagrams */
    .flow-steps {
        flex-direction: column;
    }
    
    .flow-arrow {
        transform: rotate(90deg);
    }
    
    /* Story Meta */
    .story-meta {
        flex-direction: column;
        gap: 1rem;
    }
    
    /* Typography */
    .section-content h3,
    .story-content-wrapper h3 {
        font-size: 1.2rem;
    }
    
    .section-content h4,
    .story-content-wrapper h4 {
        font-size: 1rem;
    }
    
    /* Stats Grids */
    .info-card .stats-grid,
    .highlight-box .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .highlight-box .stats-grid .stat-card {
        min-height: auto;
        padding: 1.2rem;
    }

    .real-risks-grid {
        grid-template-columns: 1fr;
    }

    .real-risk-head {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* ========================================
   17. STORY METADATA INFOGRAPHIC
   ======================================== */

.story-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.story-meta-card {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.6) 0%, rgba(26, 26, 46, 0.3) 100%);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.2rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.story-meta-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.story-meta-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-color);
}

.story-meta-card:hover::before {
    opacity: 1;
}

.story-meta-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.story-meta-value {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.story-meta-value .priority-badge {
    margin: 0;
}

/* Special Cards - Phase */
.story-meta-card:has(.story-meta-label:contains("Phase")) {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(102, 126, 234, 0.05) 100%);
}

/* Special Cards - Progress */
.story-meta-card:has(.story-meta-label:contains("Progress")) .story-meta-value {
    font-size: 1.8rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Story Objective Box */
.story-objective-box {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12) 0%, rgba(118, 75, 162, 0.08) 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
    position: relative;
}

.story-objective-box::before {
    content: '🎯';
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    font-size: 2rem;
    opacity: 0.3;
}

.story-objective-box h4 {
    color: var(--accent-color);
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
}

.story-objective-box p {
    color: var(--text-primary);
    line-height: 1.8;
    margin: 0;
    font-size: 1.05rem;
}

/* Story Includes Box */
.story-includes-box {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.story-includes-box h4 {
    color: var(--success);
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.story-includes-box h4::before {
    content: '✅';
    font-size: 1.2rem;
}

.story-includes-box .feature-list {
    margin: 0;
}

.story-includes-box .feature-list li {
    background: rgba(16, 185, 129, 0.08);
    border-left-color: var(--success);
}

/* Dependencies Visual */
.story-meta-card:has(.story-meta-label:contains("Dependencies")) {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(245, 158, 11, 0.05) 100%);
    border-color: rgba(245, 158, 11, 0.3);
}

.story-meta-card:has(.story-meta-label:contains("Dependencies")) .story-meta-value {
    font-size: 0.95rem;
    color: var(--warning);
}

/* Duration & Conditions Layout */
.story-meta-card:has(.story-meta-label:contains("Duration")),
.story-meta-card:has(.story-meta-label:contains("Start")),
.story-meta-card:has(.story-meta-label:contains("End")) {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.8) 0%, rgba(26, 26, 46, 0.5) 100%);
}

/* Responsive Grid */
@media (max-width: 1024px) {
    .story-meta-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    .story-meta-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .story-meta-card:has(.story-meta-label:contains("Dependencies")) {
        grid-column: 1 / -1;
    }
}

@media (max-width: 480px) {
    .story-meta-grid {
        grid-template-columns: 1fr;
    }
}

/* Visual Separator Between Metadata and Content */
.story-meta-grid + .story-objective-box,
.story-objective-box + .story-includes-box,
.story-includes-box + .story-content-wrapper {
    position: relative;
}

.story-meta-grid + .story-objective-box::before,
.story-objective-box + .story-includes-box::before {
    /* Icon already defined in other rules */
}

/* Empty State for Metadata */
.story-meta-value:empty::after,
.story-meta-value:contains("-")::after {
    content: '';
}

/* Highlight Important Metadata */
.story-meta-card:has(.priority-badge.priority-critical) {
    border-color: rgba(239, 68, 68, 0.4);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
}

.story-meta-card:has(.priority-badge.priority-high) {
    border-color: rgba(245, 158, 11, 0.4);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
}

/* Progress Bar Inside Meta Card */
.story-meta-card:has(.story-meta-label:contains("Progress")) {
    position: relative;
    overflow: visible;
}

.story-meta-card:has(.story-meta-label:contains("Progress"))::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: rgba(102, 126, 234, 0.2);
    border-radius: 0 0 10px 10px;
}

/* Animation for Cards */
@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.story-meta-card {
    animation: cardSlideIn 0.4s ease-out backwards;
}

.story-meta-card:nth-child(1) { animation-delay: 0.05s; }
.story-meta-card:nth-child(2) { animation-delay: 0.1s; }
.story-meta-card:nth-child(3) { animation-delay: 0.15s; }
.story-meta-card:nth-child(4) { animation-delay: 0.2s; }
.story-meta-card:nth-child(5) { animation-delay: 0.25s; }
.story-meta-card:nth-child(6) { animation-delay: 0.3s; }
.story-meta-card:nth-child(7) { animation-delay: 0.35s; }
.story-meta-card:nth-child(8) { animation-delay: 0.4s; }
.story-meta-card:nth-child(9) { animation-delay: 0.45s; }

/* ========================================
   18. PHASE 1 STORY ENHANCEMENTS
   ======================================== */

.phase-boundary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.phase-boundary-card {
    background: rgba(26, 26, 46, 0.45);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
}

.phase-boundary-card h4 {
    margin: 0 0 0.6rem 0;
}

.phase-criteria-list {
    margin: 0.8rem 0 0 0;
    padding-right: 1.3rem;
}

.phase-criteria-list li {
    margin: 0.5rem 0;
    color: var(--text-secondary);
    line-height: 1.75;
}

.task-lane-board {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.2rem;
    margin: 2rem 0;
}

.task-lane {
    background: rgba(26, 26, 46, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
}

.task-lane.lane-backend {
    border-top: 3px solid rgba(59, 130, 246, 0.8);
}

.task-lane.lane-frontend {
    border-top: 3px solid rgba(16, 185, 129, 0.85);
}

.task-lane-header {
    margin: 0.2rem 0 1rem 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.task-lane .task-category h5 {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-primary);
    margin: 0 0 0.6rem 0;
    font-size: 0.98rem;
}

.task-id-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    background: rgba(102, 126, 234, 0.2);
    border: 1px solid rgba(102, 126, 234, 0.45);
    color: var(--text-primary);
    font-size: 0.76rem;
    font-weight: 700;
}

.story-test-block {
    margin: 0.9rem 0 0 0;
    padding: 0.9rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(15, 15, 35, 0.8);
    color: #d4d4dc;
    overflow-x: auto;
    direction: ltr;
    text-align: left;
}

.story-test-block code {
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 0.83rem;
    line-height: 1.6;
    white-space: pre;
    display: block;
}

.security-matrix-table td:last-child {
    text-align: center;
    font-weight: 700;
}

@media (max-width: 900px) {
    .task-lane-board {
        grid-template-columns: 1fr;
    }

    .phase-boundary-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   19. PHASE 2 COMPONENTS
   ======================================== */

.phase-status-table {
    margin-top: 1rem;
}

.domain-model-box {
    margin: 2rem 0;
    padding: 1.3rem;
    border-radius: 12px;
    border: 1px solid rgba(102, 126, 234, 0.35);
    background: linear-gradient(145deg, rgba(26, 26, 46, 0.75) 0%, rgba(26, 26, 46, 0.45) 100%);
}

.domain-model-box h3 {
    margin: 0 0 0.8rem 0;
    color: var(--accent-color);
}

.phase-dod-list li {
    font-weight: 500;
}
