/**
 * FundStat Components
 * Reusable component styles
 */

/* ============================================================================
   Buttons
   ========================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-md);
    font-weight: var(--weight-semibold);
    font-family: var(--font-body);
    cursor: pointer;
    transition: all var(--transition-slow);
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--purple-500), var(--purple-700));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    color: white;
}

.btn-secondary {
    background: white;
    color: var(--purple-700);
    border: 1px solid var(--purple-200);
}

.btn-secondary:hover {
    background: var(--purple-50);
    border-color: var(--purple-300);
    color: var(--purple-800);
}

.btn-calculate {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--purple-500), var(--purple-700));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    cursor: pointer;
    transition: all var(--transition-slow);
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* ============================================================================
   Cards
   ========================================================================= */

.card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-slow);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    margin-bottom: var(--space-lg);
}

.card-title {
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
    color: var(--purple-900);
    margin-bottom: var(--space-sm);
}

.card-subtitle {
    font-size: var(--text-base);
    color: var(--purple-600);
}

.card-body {
    font-size: var(--text-md);
    color: var(--purple-700);
    line-height: var(--leading-relaxed);
}

.card-footer {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--purple-100);
}

/* Result Cards */
.result-card {
    background: linear-gradient(135deg, var(--purple-50), white);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    border: 1px solid var(--purple-200);
}

.result-label {
    font-size: var(--text-sm);
    color: var(--purple-600);
    margin-bottom: var(--space-sm);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-value {
    font-family: var(--font-mono);
    font-size: var(--text-3xl);
    font-weight: var(--weight-bold);
    color: var(--purple-900);
}

.result-value.large {
    font-size: var(--text-4xl);
}

/* ============================================================================
   Badges & Tags
   ========================================================================= */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.5rem 1rem;
    background: white;
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
}

.badge.positive {
    color: var(--color-positive);
}

.badge.negative {
    color: var(--color-negative);
}

.tag {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    background: var(--purple-50);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    color: var(--purple-600);
    font-weight: var(--weight-medium);
}

.tag.primary {
    background: var(--purple-100);
    color: var(--purple-700);
}

/* ============================================================================
   Forms
   ========================================================================= */

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--purple-700);
    margin-bottom: var(--space-sm);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.875rem 1.25rem;
    border: 1px solid var(--purple-200);
    border-radius: var(--radius-md);
    font-size: var(--text-md);
    font-family: var(--font-mono);
    color: var(--purple-900);
    background: var(--bg-input);
    transition: all var(--transition-base);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--purple-500);
    background: white;
    box-shadow: 0 0 0 3px rgba(139, 95, 184, 0.1);
}

.form-input::placeholder {
    color: var(--purple-400);
}

.form-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--purple-300);
    border-radius: 4px;
    cursor: pointer;
    accent-color: var(--purple-500);
}

.form-checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-md);
    color: var(--purple-700);
    cursor: pointer;
}

/* Date Inputs */
.date-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 768px) {
    .date-inputs {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

/* ============================================================================
   Tables
   ========================================================================= */

.table-wrapper {
    background: white;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: linear-gradient(180deg, var(--purple-100) 0%, var(--purple-50) 100%);
}

th {
    text-align: left;
    padding: 1.25rem 1.5rem;
    font-weight: var(--weight-semibold);
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--purple-700);
    border-bottom: 2px solid var(--purple-200);
}

th:first-child {
    padding-left: 2rem;
}

th:last-child {
    padding-right: 2rem;
}

tbody tr {
    border-bottom: 1px solid var(--purple-100);
    transition: all var(--transition-base);
}

tbody tr:hover {
    background: linear-gradient(90deg, transparent, var(--purple-50), transparent);
}

tbody tr:last-child {
    border-bottom: none;
}

td {
    padding: 1.25rem 1.5rem;
    font-size: var(--text-md);
    color: var(--purple-900);
}

td:first-child {
    padding-left: 2rem;
}

td:last-child {
    padding-right: 2rem;
}

/* Table Values */
.table-mono {
    font-family: var(--font-mono);
    font-weight: var(--weight-semibold);
}

.table-positive {
    color: var(--color-positive);
    font-weight: var(--weight-bold);
}

.table-negative {
    color: var(--color-negative);
    font-weight: var(--weight-bold);
}

/* ============================================================================
   Filters
   ========================================================================= */

.filters-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.625rem 1.25rem;
    background: white;
    border: 1px solid var(--purple-200);
    border-radius: var(--radius-md);
    color: var(--purple-700);
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-body);
}

.filter-btn:hover {
    background: var(--purple-50);
    border-color: var(--purple-300);
}

.filter-btn.active {
    background: var(--purple-600);
    color: white;
    border-color: var(--purple-600);
}

/* ============================================================================
   Info Panels
   ========================================================================= */

.info-section {
    margin-top: 2rem;
    padding: 1.75rem 2rem;
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--purple-200);
}

.info-title {
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    color: var(--purple-900);
    margin-bottom: 1rem;
}

.info-text {
    font-size: var(--text-md);
    color: var(--purple-700);
    line-height: var(--leading-relaxed);
}

/* ============================================================================
   Page Header
   ========================================================================= */

.page-header {
    margin-bottom: 3rem;
}

.page-title {
    font-size: var(--text-4xl);
    font-weight: var(--weight-bold);
    color: var(--purple-900);
    margin-bottom: var(--space-sm);
    letter-spacing: -0.03em;
}

.page-subtitle {
    font-size: var(--text-xl);
    color: var(--purple-600);
}

@media (max-width: 768px) {
    .page-header {
        margin-bottom: 1.5rem;
    }

    .page-title {
        font-size: 1.75rem;
        letter-spacing: -0.02em;
    }

    .page-subtitle {
        font-size: var(--text-md);
        line-height: var(--leading-normal);
    }
}

/* ============================================================================
   Charts
   ========================================================================= */

.chart-placeholder {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--purple-200);
    position: relative;
    overflow: hidden;
}

.chart-line {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70%;
    background: linear-gradient(180deg, rgba(139, 95, 184, 0.2) 0%, rgba(139, 95, 184, 0.05) 100%);
    clip-path: polygon(
        0% 60%, 5% 55%, 10% 58%, 15% 50%, 20% 52%,
        25% 45%, 30% 42%, 35% 48%, 40% 40%, 45% 38%,
        50% 35%, 55% 30%, 60% 28%, 65% 32%, 70% 25%,
        75% 22%, 80% 20%, 85% 15%, 90% 12%, 95% 10%,
        100% 8%, 100% 100%, 0% 100%
    );
}

.chart-text {
    font-size: var(--text-base);
    color: var(--purple-600);
    z-index: 1;
}

@media (max-width: 768px) {
    .chart-placeholder {
        height: 180px;
        padding: 1.5rem;
    }
}

/* ============================================================================
   Loading States
   ========================================================================= */

.loading {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--purple-200);
    border-top-color: var(--purple-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.skeleton {
    background: linear-gradient(90deg, var(--purple-100) 25%, var(--purple-50) 50%, var(--purple-100) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================================
   OFZ Page Components
   ========================================================================= */

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--purple-800);
    font-weight: var(--weight-medium);
    transition: color var(--transition-base);
}

.radio-label:hover {
    color: var(--purple-900);
}

.radio-label input[type="radio"] {
    margin-right: 0.5rem;
    width: 1.125rem;
    height: 1.125rem;
    cursor: pointer;
    accent-color: var(--purple-600);
}

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

.stat-card {
    background: white;
    border: 1px solid var(--purple-100);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--purple-200);
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--purple-600);
    margin-bottom: 0.5rem;
    font-weight: var(--weight-medium);
}

.stat-value {
    font-size: 1.875rem;
    font-weight: var(--weight-bold);
    color: var(--purple-700);
    font-family: var(--font-mono);
}

.chart-container {
    position: relative;
    height: 60vh;
    min-height: 400px;
    width: 100%;
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--purple-100);
}

.chart-controls {
    margin-top: 1rem;
    text-align: center;
}

.chart-button {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--purple-500), var(--purple-700));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--text-md);
    font-weight: var(--weight-semibold);
    font-family: var(--font-body);
    transition: all var(--transition-base);
}

.chart-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .chart-container {
        height: 50vh;
        min-height: 300px;
        padding: 1rem;
    }
}

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

    .stat-value {
        font-size: 1.5rem;
    }
}

/* ============================================================================
   News Archive Components
   ========================================================================= */

.filter-select {
    padding: 0.625rem 1rem;
    border: 1px solid var(--purple-200);
    border-radius: var(--radius-md);
    font-size: var(--text-md);
    color: var(--purple-900);
    background: white;
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-body);
}

.filter-select:hover {
    border-color: var(--purple-300);
}

.filter-select:focus {
    outline: none;
    border-color: var(--purple-500);
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
}

.news-list {
    margin: 2rem 0;
}

.news-card {
    background: white;
    border: 1px solid var(--purple-100);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.news-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--purple-200);
}

.news-title {
    margin: 0 0 1rem 0;
    color: var(--purple-900);
    font-size: 1.5rem;
    font-weight: var(--weight-bold);
    line-height: 1.3;
}

.news-content {
    color: var(--purple-800);
    line-height: 1.6;
    margin: 1rem 0;
}

.news-content p {
    margin: 0.75rem 0;
}

.news-content strong {
    font-weight: var(--weight-bold);
    color: var(--purple-900);
}

.news-content em {
    font-style: italic;
    color: var(--purple-700);
}

.news-meta {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--purple-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.market-badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-md);
    font-weight: var(--weight-semibold);
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.market-badge.market-up {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success-700);
    border: 1px solid var(--success-200);
}

.market-badge.market-down {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-700);
    border: 1px solid var(--error-200);
}

.market-badge.market-mixed {
    background: rgba(251, 191, 36, 0.1);
    color: var(--warning-700);
    border: 1px solid var(--warning-200);
}

.featured-badge {
    margin-left: 0.75rem;
    color: var(--purple-600);
    font-weight: var(--weight-medium);
}

.news-date {
    color: var(--purple-600);
    font-size: var(--text-sm);
    font-family: var(--font-mono);
}

.no-news {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--purple-700);
    background: white;
    border: 1px solid var(--purple-100);
    border-radius: var(--radius-lg);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 3rem 0;
    flex-wrap: wrap;
}

.page-link,
.page-current,
.page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    padding: 0.625rem 1rem;
    border-radius: var(--radius-md);
    font-size: var(--text-md);
    font-weight: var(--weight-medium);
    text-decoration: none;
    transition: all var(--transition-base);
}

.page-link {
    background: white;
    color: var(--purple-700);
    border: 1px solid var(--purple-200);
}

.page-link:hover {
    background: var(--purple-50);
    border-color: var(--purple-300);
    color: var(--purple-800);
}

.page-current {
    background: linear-gradient(135deg, var(--purple-500), var(--purple-700));
    color: white;
    border: 1px solid var(--purple-600);
    font-weight: var(--weight-semibold);
}

.page-ellipsis {
    background: transparent;
    border: none;
    color: var(--purple-500);
    cursor: default;
}

@media (max-width: 768px) {
    .news-card {
        padding: 1.5rem;
    }

    .news-title {
        font-size: 1.25rem;
    }

    .news-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .pagination {
        gap: 0.25rem;
    }

    .page-link,
    .page-current {
        min-width: 2rem;
        padding: 0.5rem 0.75rem;
        font-size: var(--text-sm);
    }
}
