/**
 * CursBNR Custom Styles
 * Stiluri personalizate pentru aplicația de cursuri valutare BNR
 */

/* =====================
   Root Variables
   ===================== */
:root {
    --primary-color: #0d6efd;
    --primary-color-dark: #0a58ca;  /* Darker blue for WCAG AA contrast on light bg */
    --secondary-color: #6c757d;
    --secondary-color-dark: #495057;  /* Darker for better contrast */
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
}

/* =====================
   Global Accessibility Contrast Fixes
   ===================== */
/* Override Bootstrap text-primary for WCAG AA compliance on light backgrounds */
.text-primary {
    color: var(--primary-color-dark) !important;
}

/* Override Bootstrap text-muted for better contrast */
.text-muted {
    color: #495057 !important;  /* Darker than Bootstrap default #6c757d */
}

/* =====================
   Base Styles
   ===================== */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f5f7fa;
}

main {
    flex: 1;
}

/* =====================
   Navbar Styles
   ===================== */
.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.nav-link {
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--primary-color) !important;
}

.nav-link.active {
    color: var(--primary-color) !important;
    font-weight: 600;
}

/* =====================
   Card Styles
   ===================== */
.card {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-radius: 0.5rem;
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

/* =====================
   Table Styles
   ===================== */
.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: #495057;  /* Darker gray for better contrast (WCAG AA compliant) */
    border-top: none;
}

.table th a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.table th a:hover {
    color: var(--primary-color);
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

.table-primary {
    --bs-table-bg: rgba(13, 110, 253, 0.08);
}

/* Links in table body - ensure they are distinguishable */
.table tbody a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.table tbody a:hover {
    text-decoration-thickness: 2px;
}

/* =====================
   Badge Styles
   ===================== */
.badge {
    font-weight: 500;
    padding: 0.4em 0.6em;
}

/* =====================
   Button Styles
   ===================== */
.btn {
    font-weight: 500;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.btn-primary {
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.4);
    transform: translateY(-1px);
}

/* Improved contrast for outline buttons (WCAG AA) */
.btn-outline-secondary {
    color: #495057;  /* Darker gray for better contrast */
    border-color: #495057;
}

.btn-outline-secondary:hover {
    background-color: #495057;
    border-color: #495057;
    color: #fff;
}

.btn-outline-primary {
    color: #0a58ca;  /* Darker blue for better contrast */
    border-color: #0a58ca;
}

.btn-outline-primary:hover {
    background-color: #0a58ca;
    border-color: #0a58ca;
    color: #fff;
}

/* =====================
   Form Styles
   ===================== */
.form-control, .form-select {
    border-radius: 0.375rem;
    border-color: #dee2e6;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--secondary-color);
}

/* =====================
   Alert Styles
   ===================== */
.alert {
    border-radius: 0.5rem;
    border: none;
}

.alert-light {
    background-color: #fff;
    border: 1px solid #dee2e6;
}

/* =====================
   Currency Cards (Homepage)
   ===================== */
.currency-card {
    position: relative;
    overflow: hidden;
}

.currency-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--primary-color);
}

/* =====================
   Trend Indicators
   ===================== */
.trend-up {
    color: var(--success-color);
}

.trend-down {
    color: var(--danger-color);
}

.trend-unchanged {
    color: var(--secondary-color);
}

/* =====================
   Chart Container
   ===================== */
.chart-container {
    position: relative;
    width: 100%;
    min-height: 300px;
}

/* =====================
   Footer Styles
   ===================== */
footer {
    background-color: var(--light-color);
}

/* Footer brand - styled like h5 but using <p> for proper heading hierarchy */
footer .footer-brand {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Footer headings - styled like h6 but using <p> for proper heading hierarchy */
footer .footer-heading {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

footer a {
    color: #495057;  /* Darker gray for better contrast (4.5:1 ratio on light bg) */
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

footer a:hover {
    color: #0a58ca;  /* Darker primary blue */
    text-decoration-color: #0a58ca;
}

/* Footer navigation links - improved touch targets */
footer .list-unstyled li {
    margin-bottom: 0.5rem;
}

footer .list-unstyled li a {
    display: inline-block;
    padding: 0.25rem 0;
    min-height: 44px;
    line-height: 1.5;
}

/* =====================
   Utility Classes
   ===================== */
.text-financial {
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color), #0a58ca);
}

/* =====================
   Desktop Content Width
   ===================== */
@media (min-width: 992px) {
    main > .container {
        max-width: 924px !important;
    }
}

/* =====================
   Responsive Adjustments
   ===================== */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .display-5 {
        font-size: 2rem;
    }
    
    .display-6 {
        font-size: 1.5rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    h1.h2 {
        font-size: 1.5rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
    }
    
    /* Compact table on mobile */
    .table td, .table th {
        padding: 0.5rem 0.35rem;
        font-size: 0.8rem;
    }
    
    .table th {
        font-size: 0.7rem;
    }
    
    .table .badge {
        font-size: 0.7rem;
        padding: 0.25em 0.4em;
    }
}

/* =====================
   Print Styles
   ===================== */
@media print {
    .navbar, footer, .btn, .form-control, .form-select {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
    
    body {
        background-color: #fff;
    }
}

/* =====================
   Breadcrumb Styles (WCAG AA Contrast)
   ===================== */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 0;
}

.breadcrumb-item a {
    color: #0a58ca;  /* Darker blue for WCAG AA compliance (4.5:1 contrast ratio) */
    text-decoration: underline;
    text-underline-offset: 2px;
}

.breadcrumb-item a:hover {
    color: #0842a0;  /* Even darker on hover */
    text-decoration-thickness: 2px;
}

.breadcrumb-item.active {
    color: #495057;  /* Dark gray for sufficient contrast */
}

.breadcrumb-item + .breadcrumb-item::before {
    color: #6c757d;
}

/* =====================
   Accessibility
   ===================== */
.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Focus styles for keyboard navigation */
a:focus, button:focus, input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* =====================
   Loading Animation
   ===================== */
.loading {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--light-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

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

/* =====================
   Quick Converter Widget
   ===================== */
.quick-converter-widget {
    background: linear-gradient(135deg, #0d4680 0%, #0a3d6e 100%);
    border-radius: 0.5rem;
    overflow: visible;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 400px;
    width: 400px;
}

.qc-header {
    background: linear-gradient(135deg, #0a3d6e 0%, #082f54 100%);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    text-align: center;
    padding: 0.75rem 1rem;
    letter-spacing: 0.5px;
}

.qc-header i {
    margin-right: 0.5rem;
}

.qc-subheader {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.75rem;
    text-align: center;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.qc-body {
    padding: 1rem;
}

.qc-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.qc-row:last-child {
    margin-bottom: 0;
}

.qc-label {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.875rem;
    font-weight: 500;
    width: 80px;
    flex-shrink: 0;
}

.qc-select {
    flex: 1;
    background: #fff;
    border: none;
    border-radius: 0.25rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23333' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 12px;
}

.qc-select:focus {
    outline: 2px solid #ffc107;
    outline-offset: 1px;
}

.qc-input-group {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.qc-input {
    flex: 1;
    background: #fff;
    border: none;
    border-radius: 0.25rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #333;
    text-align: right;
    min-width: 0;
}

.qc-input:focus {
    outline: 2px solid #ffc107;
    outline-offset: 1px;
}

.qc-input.qc-result {
    background: #e8f4ff;
    color: #0a3d6e;
}

.qc-currency-label {
    color: #fff;
    font-weight: 600;
    font-size: 0.8rem;
    min-width: 32px;
    flex-shrink: 0;
}

.qc-swap-btn,
.qc-copy-btn {
    background: #f39c12;
    border: none;
    border-radius: 0.25rem;
    width: 30px;
    height: 30px;
    min-width: 30px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.qc-swap-btn:hover,
.qc-copy-btn:hover {
    background: #e67e22;
    transform: scale(1.05);
}

.qc-copy-btn {
    background: rgba(255, 255, 255, 0.2);
}

.qc-copy-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.qc-result-row .qc-label {
    color: #fff;
    font-weight: 600;
}

/* Desktop layout: sidebar positioning - only on very wide screens */
/* Requires: sidebar (400px) + gap (20px) + content (924px) + margins = ~1400px minimum */
@media (min-width: 1450px) {
    .quick-converter-sidebar {
        position: fixed;
        left: 20px;
        top: 100px;
        z-index: 100;
    }
    
    .quick-converter-widget {
        max-width: 400px;
        width: 400px;
    }
    
    .quick-converter-mobile {
        display: none !important;
    }
}

/* Medium-large screens: hide sidebar, show mobile version below content */
@media (min-width: 768px) and (max-width: 1449px) {
    .quick-converter-sidebar {
        display: none !important;
    }
    
    .quick-converter-mobile {
        display: block !important;
        margin: 2rem auto;
        max-width: 500px;
    }
    
    .quick-converter-widget {
        max-width: 500px;
        width: 100%;
    }
}

/* Mobile: below content, full width */
@media (max-width: 767px) {
    .quick-converter-sidebar {
        display: none !important;
    }
    
    .quick-converter-mobile {
        display: block !important;
        margin: 1.5rem auto;
        max-width: 100%;
    }
    
    .quick-converter-widget {
        max-width: 100%;
        width: 100%;
    }
    
    .qc-row {
        flex-wrap: wrap;
    }
    
    .qc-label {
        width: 100%;
        margin-bottom: 0.25rem;
    }
    
    .qc-input-group,
    .qc-select {
        width: 100%;
    }
}

/* Ensure widget is centered in container */
.quick-converter-sidebar .quick-converter-widget,
.quick-converter-mobile .quick-converter-widget {
    margin: 0 auto;
}