/* ========================================
   TECHNICAL ANALYSIS MASTERY STYLES
   AlphaVault AI - Resources Page
   ======================================== */

/* ========================================
   CHART CONTAINERS
   ======================================== */

.chart-container {
    width: 100%;
    height: 450px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
    transition: all 0.3s ease;
}

body.dark-mode .chart-container {
    background: rgba(30, 41, 59, 0.95);
}

.chart-container:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.chart-container canvas {
    max-height: 100%;
}

.chart-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
}

/* ========================================
   FORMULA BLOCKS
   ======================================== */

.formula-block {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-left: 4px solid #667eea;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    transition: all 0.3s ease;
}

.formula-block:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
}

.formula-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #667eea;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.formula-title::before {
    content: '∑';
    font-size: 1.5rem;
    font-weight: 900;
}

.formula-content {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.5);
    padding: 1rem;
    border-radius: 8px;
    line-height: 1.8;
    overflow-x: auto;
    word-wrap: break-word;
    color: #1e293b;
}

body.dark-mode .formula-content {
    background: rgba(15, 23, 42, 0.5);
    color: #e2e8f0;
}

.formula-legend {
    margin-top: 1rem;
    font-size: 0.95rem;
}

.formula-legend dt {
    font-weight: 700;
    color: #667eea;
    margin-top: 0.5rem;
}

.formula-legend dd {
    margin-left: 1rem;
    margin-bottom: 0.5rem;
    color: #64748b;
}

body.dark-mode .formula-legend dd {
    color: #94a3b8;
}

/* ========================================
   EXAMPLE CARDS
   ======================================== */

.example-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 2px solid rgba(102, 126, 234, 0.2);
    transition: all 0.3s ease;
}

body.dark-mode .example-card {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(102, 126, 234, 0.3);
}

.example-card:hover {
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.example-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-weight: 800;
    color: #667eea;
}

.example-header i {
    font-size: 1.5rem;
}

.example-content {
    font-size: 0.95rem;
    line-height: 1.8;
}

.example-content p {
    margin-bottom: 1rem;
}

/* ========================================
   INFO / SUCCESS / WARNING BOXES
   ======================================== */

.info-box,
.success-box,
.warning-box {
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
    transition: all 0.3s ease;
}

.info-box:hover,
.success-box:hover,
.warning-box:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.info-box {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.1));
    border-left: 4px solid #3b82f6;
}

.success-box {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(22, 163, 74, 0.1));
    border-left: 4px solid #22c55e;
}

.warning-box {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.1));
    border-left: 4px solid #ef4444;
}

.box-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.box-header i {
    font-size: 1.5rem;
}

.info-box .box-header {
    color: #3b82f6;
}

.success-box .box-header {
    color: #22c55e;
}

.warning-box .box-header {
    color: #ef4444;
}

.box-content {
    font-size: 0.95rem;
    line-height: 1.8;
}

.box-content p {
    margin-bottom: 1rem;
}

.box-content ul,
.box-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.box-content li {
    margin-bottom: 0.75rem;
}

/* ========================================
   STYLED LISTS
   ======================================== */

.styled-list {
    list-style: none;
    padding-left: 0;
    margin: 1rem 0;
}

.styled-list li {
    position: relative;
    padding-left: 1.75rem;
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.styled-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #22c55e;
    font-weight: 700;
    font-size: 1.1rem;
}

/* ========================================
   DATA TABLES
   ======================================== */

.data-table-wrapper {
    overflow-x: auto;
    margin: 2rem 0;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    min-width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

body.dark-mode .data-table {
    background: #1e293b;
}

.data-table thead {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
}

.data-table th {
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.data-table td {
    font-size: 0.95rem;
}

.data-table tbody tr {
    transition: background 0.2s ease;
}

.data-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

body.dark-mode .data-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.1);
}

/* ========================================
   SECTION HEADERS
   ======================================== */

.section-header {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    margin-top: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-header i {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2rem;
}

.subsection-header {
    font-size: 1.5rem;
    font-weight: 800;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #667eea;
    position: relative;
    padding-left: 1.5rem;
}

.subsection-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 70%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 2px;
}

body.dark-mode .subsection-header {
    color: #818cf8;
}

.content-text {
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    color: #475569;
}

body.dark-mode .content-text {
    color: #cbd5e1;
}

.content-text strong {
    color: #1e293b;
    font-weight: 700;
}

body.dark-mode .content-text strong {
    color: #f1f5f9;
}

/* ========================================
   SCROLLBAR STYLING (WEBKIT)
   ======================================== */

.data-table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.data-table-wrapper::-webkit-scrollbar-track {
    background: rgba(226, 232, 240, 0.5);
    border-radius: 4px;
}

.data-table-wrapper::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 4px;
}

.data-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.7);
}

/* ========================================
   MOBILE RESPONSIVENESS - TABLET
   Max Width: 768px
   ======================================== */

@media (max-width: 768px) {
    /* Chart containers */
    .chart-container {
        height: 350px;
        padding: 1.5rem;
        margin: 1.5rem 0;
        border-radius: 12px;
    }
    
    .chart-title {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    
    /* Formula blocks */
    .formula-block {
        padding: 1.5rem;
        margin: 1.5rem 0;
    }
    
    .formula-title {
        font-size: 1rem;
    }
    
    .formula-content {
        font-size: 1rem;
        padding: 0.875rem;
    }
    
    .formula-legend {
        font-size: 0.875rem;
    }
    
    /* Example cards */
    .example-card {
        padding: 1.5rem;
        margin: 1.5rem 0;
    }
    
    .example-header {
        font-size: 1rem;
    }
    
    .example-content {
        font-size: 0.875rem;
    }
    
    /* Info/Success/Warning boxes */
    .info-box,
    .success-box,
    .warning-box {
        padding: 1.25rem;
        margin: 1.5rem 0;
    }
    
    .box-header {
        font-size: 1rem;
    }
    
    .box-content {
        font-size: 0.875rem;
    }
    
    /* Section headers */
    .section-header {
        font-size: 1.75rem;
        margin-top: 1.5rem;
        margin-bottom: 1.25rem;
    }
    
    .subsection-header {
        font-size: 1.35rem;
        margin-top: 1.5rem;
    }
    
    .content-text {
        font-size: 0.95rem;
        margin-bottom: 1.25rem;
    }
    
    /* Data tables */
    .data-table th,
    .data-table td {
        padding: 0.875rem;
        font-size: 0.875rem;
    }
    
    .data-table th {
        font-size: 0.8rem;
    }
}

/* ========================================
   MOBILE RESPONSIVENESS - SMARTPHONE
   Max Width: 480px
   ======================================== */

@media (max-width: 480px) {
    /* Chart containers compact */
    .chart-container {
        height: 280px;
        padding: 1rem;
        margin: 1rem 0;
        border-radius: 10px;
    }
    
    .chart-title {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
        line-height: 1.3;
    }
    
    /* Formula blocks minimal */
    .formula-block {
        padding: 1rem;
        margin: 1rem 0;
        border-radius: 10px;
    }
    
    .formula-title {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
    }
    
    .formula-content {
        font-size: 0.875rem;
        padding: 0.75rem;
        line-height: 1.6;
    }
    
    .formula-legend {
        font-size: 0.8rem;
    }
    
    .formula-legend dt {
        margin-top: 0.4rem;
    }
    
    .formula-legend dd {
        margin-left: 0.75rem;
        margin-bottom: 0.4rem;
    }
    
    /* Example cards compact */
    .example-card {
        padding: 1rem;
        margin: 1rem 0;
        border-radius: 10px;
    }
    
    .example-header {
        font-size: 0.95rem;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .example-header i {
        font-size: 1.1rem;
    }
    
    .example-content {
        font-size: 0.85rem;
        line-height: 1.6;
    }
    
    .example-content p {
        margin-bottom: 0.75rem;
    }
    
    /* Info/Success/Warning boxes compact */
    .info-box,
    .success-box,
    .warning-box {
        padding: 1rem;
        margin: 1rem 0;
        border-radius: 10px;
    }
    
    .box-header {
        font-size: 0.95rem;
        gap: 0.5rem;
        margin-bottom: 0.75rem;
    }
    
    .box-content {
        font-size: 0.85rem;
        line-height: 1.6;
    }
    
    .box-content p {
        margin-bottom: 0.75rem;
    }
    
    .box-content ul,
    .box-content ol {
        margin: 0.75rem 0;
    }
    
    .box-content ol {
        padding-left: 1.25rem;
    }
    
    .box-content li {
        margin-bottom: 0.5rem;
    }
    
    /* Styled lists compact */
    .styled-list li {
        padding-left: 1.5rem;
        margin-bottom: 0.5rem;
        font-size: 0.85rem;
        line-height: 1.5;
    }
    
    /* Section headers mobile */
    .section-header {
        font-size: 1.5rem;
        gap: 0.75rem;
        margin-top: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .section-header i {
        font-size: 1.35rem;
    }
    
    .subsection-header {
        font-size: 1.25rem;
        margin-top: 1.5rem;
        margin-bottom: 0.75rem;
        padding-left: 1.25rem;
    }
    
    .content-text {
        font-size: 0.875rem;
        line-height: 1.6;
        margin-bottom: 1rem;
    }
    
    /* Data tables responsive */
    .data-table-wrapper {
        margin: 1rem 0;
        border-radius: 10px;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .data-table th {
        font-size: 0.7rem;
        letter-spacing: 0.3px;
    }
    
    /* Hide some columns on mobile if needed */
    .data-table th:nth-child(4),
    .data-table td:nth-child(4) {
        display: none;
    }
}

/* ========================================
   MOBILE RESPONSIVENESS - VERY SMALL
   Max Width: 360px
   ======================================== */

@media (max-width: 360px) {
    /* Chart containers minimal */
    .chart-container {
        height: 240px;
        padding: 0.75rem;
        margin: 0.75rem 0;
    }
    
    .chart-title {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
    }
    
    /* Formula blocks ultra-compact */
    .formula-block {
        padding: 0.875rem;
        margin: 0.875rem 0;
    }
    
    .formula-title {
        font-size: 0.875rem;
    }
    
    .formula-content {
        font-size: 0.8rem;
        padding: 0.625rem;
    }
    
    .formula-legend {
        font-size: 0.75rem;
    }
    
    /* Example cards ultra-compact */
    .example-card {
        padding: 0.875rem;
        margin: 0.875rem 0;
    }
    
    .example-header {
        font-size: 0.875rem;
    }
    
    .example-content {
        font-size: 0.8rem;
    }
    
    /* Info boxes ultra-compact */
    .info-box,
    .success-box,
    .warning-box {
        padding: 0.875rem;
        margin: 0.875rem 0;
    }
    
    .box-header {
        font-size: 0.875rem;
    }
    
    .box-content {
        font-size: 0.8rem;
    }
    
    /* Section headers minimal */
    .section-header {
        font-size: 1.35rem;
        gap: 0.5rem;
        margin-top: 1rem;
    }
    
    .subsection-header {
        font-size: 1.15rem;
        margin-top: 1.25rem;
    }
    
    .content-text {
        font-size: 0.8rem;
    }
    
    /* Data tables ultra-compact */
    .data-table th,
    .data-table td {
        padding: 0.5rem 0.35rem;
        font-size: 0.75rem;
    }
    
    .data-table th {
        font-size: 0.65rem;
    }
    
    /* Hide additional columns on very small screens */
    .data-table th:nth-child(3),
    .data-table td:nth-child(3),
    .data-table th:nth-child(4),
    .data-table td:nth-child(4) {
        display: none;
    }
}

/* ========================================
   CHART.JS CANVAS SPECIFIC OPTIMIZATIONS
   ======================================== */

@media (max-width: 768px) {
    /* Reduce Chart.js font sizes on tablet */
    .chart-container canvas {
        font-size: 10px !important;
    }
}

@media (max-width: 480px) {
    /* Reduce Chart.js font sizes on mobile */
    .chart-container canvas {
        font-size: 8px !important;
    }
    
    /* Reduce legend padding */
    .chart-container .chartjs-legend {
        padding: 0.5rem !important;
    }
    
    /* Stack legends vertically on mobile */
    .chart-container .chartjs-legend-item {
        display: block !important;
        margin-bottom: 0.25rem !important;
    }
}

@media (max-width: 360px) {
    /* Minimal Chart.js font sizes */
    .chart-container canvas {
        font-size: 7px !important;
    }
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

@media (max-width: 768px) {
    /* Disable complex animations on mobile */
    .chart-container {
        will-change: auto;
    }
    
    /* Reduce box shadows on mobile */
    .chart-container,
    .example-card,
    .data-table-wrapper {
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    }
}

@media (max-width: 480px) {
    /* Minimal shadows on smartphone */
    .chart-container,
    .example-card,
    .data-table-wrapper,
    .formula-block {
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
    }
}

/* ========================================
   LANDSCAPE MODE ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) and (orientation: landscape) {
    /* Increase chart height in landscape mode */
    .chart-container {
        height: 300px;
    }
}

@media (max-width: 480px) and (orientation: landscape) {
    .chart-container {
        height: 250px;
    }
}

/* ========================================
   ACCESSIBILITY & TOUCH IMPROVEMENTS
   ======================================== */

@media (max-width: 480px) {
    /* Increase touch targets */
    .box-header,
    .example-header {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Better tap areas for links in tables */
    .data-table a {
        display: inline-block;
        min-height: 44px;
        line-height: 44px;
    }
}

/* ========================================
   DARK MODE ENHANCEMENTS
   ======================================== */

body.dark-mode .chart-container:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

body.dark-mode .formula-block:hover {
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

body.dark-mode .example-card:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

body.dark-mode .data-table th,
body.dark-mode .data-table td {
    border-bottom-color: rgba(71, 85, 105, 0.5);
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .chart-container,
    .example-card,
    .formula-block,
    .info-box,
    .success-box,
    .warning-box {
        page-break-inside: avoid;
        box-shadow: none !important;
    }
    
    .chart-container {
        height: auto;
    }
}