/* ======================
   ADVANCED CURRENCY CONVERTER STYLES
   ====================== */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --danger-color: #ef4444;
    --warning-color: #f97316;
    --success-color: #22c55e;
    --info-color: #06b6d4;
    
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-dark: #0f172a;
    
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.tool-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    align-items: start;
}

/* ======================
   PROFESSIONAL HEADER
   ====================== */
.tool-header {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.9) 100%);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255,255,255,0.2);
    margin-bottom: 2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.header-text h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.header-text h1 i {
    margin-right: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tool-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
}

.header-stats {
    display: flex;
    gap: 2rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: rgba(255,255,255,0.7);
    border-radius: var(--radius-lg);
    min-width: 100px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ======================
   TEMPLATE SECTION
   ====================== */
.template-section {
    grid-column: 1 / -1;
    margin-bottom: 2rem;
}

.template-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.template-section h2 i {
    color: var(--accent-color);
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.template-card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: var(--shadow-md);
}

.template-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    background: rgba(255,255,255,1);
}

.template-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.template-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.template-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ======================
   MAIN CONVERTER CONTAINER
   ====================== */
.converter-container {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255,255,255,0.2);
    overflow: hidden;
}

/* ======================
   TAB NAVIGATION
   ====================== */
.tab-navigation {
    display: flex;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    background: rgba(255,255,255,0.5);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--bg-primary);
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-btn i {
    font-size: 1.1rem;
}

/* ======================
   TAB CONTENT
   ====================== */
.tab-content {
    display: none;
    padding: 2rem;
}

.tab-content.active {
    display: block;
}

/* ======================
   CONVERTER MAIN
   ====================== */
.converter-main {
    display: grid;
    gap: 2rem;
}

.conversion-panel {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

/* Amount Section */
.amount-section {
    margin-bottom: 2rem;
}

.amount-section label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.amount-input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#amount {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
}

#amount:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.amount-presets {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.preset-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.preset-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Currency Section */
.currency-section {
    margin-bottom: 2rem;
}

.currency-group {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: end;
}

.currency-input label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.currency-select-wrapper {
    position: relative;
}

.currency-select-wrapper select {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: var(--bg-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.currency-select-wrapper select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.currency-flag {
    position: absolute;
    right: 3rem;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 18px;
    border-radius: 2px;
    background-size: cover;
    background-position: center;
}

.swap-btn {
    padding: 1rem;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.swap-btn:hover {
    background: var(--primary-dark);
    transform: rotate(180deg);
}

/* Result Section */
.result-section {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    border: 1px solid var(--border-light);
}

.conversion-result {
    margin-bottom: 1.5rem;
}

.result-amount {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.exchange-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.rate-info {
    color: var(--text-secondary);
    font-size: 1rem;
}

.rate-change {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.rate-change.positive {
    color: var(--success-color);
    background: rgba(34, 197, 94, 0.1);
}

.rate-change.negative {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

.conversion-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.action-btn {
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Popular Pairs */
.popular-pairs h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.popular-pairs h3 i {
    color: var(--accent-color);
}

.pairs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.pair-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pair-card:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.pair-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.pair-rate {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* ======================
   RATES TABLE
   ====================== */
.rates-panel {
    max-height: 600px;
    overflow-y: auto;
}

.rates-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.rates-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rates-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.rates-controls select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
}

.refresh-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-sm);
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.refresh-btn:hover {
    background: var(--primary-dark);
}

.rates-table-container {
    overflow-x: auto;
}

.rates-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.rates-table th,
.rates-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.rates-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-primary);
}

.rates-table tr:hover {
    background: var(--bg-secondary);
}

/* ======================
   CHARTS
   ====================== */
.charts-panel {
    height: 600px;
    display: flex;
    flex-direction: column;
}

.chart-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.chart-selectors {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-selectors select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
}

.time-range {
    display: flex;
    gap: 0.5rem;
}

.range-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.range-btn:hover,
.range-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.chart-container {
    flex: 1;
    position: relative;
    margin-bottom: 1.5rem;
}

.chart-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.stat-box {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
}

.stat-box .stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-box .stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ======================
   ALERTS PANEL
   ====================== */
.alerts-panel {
    display: grid;
    gap: 2rem;
}

.alert-creator {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.alert-creator h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.alert-inputs {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
}

.pair-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pair-selector select {
    flex: 1;
}

.notification-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.create-alert-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.create-alert-btn:hover {
    background: var(--primary-dark);
}

.active-alerts h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.alerts-list {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    min-height: 200px;
}

.no-alerts {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

.no-alerts i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ======================
   CALCULATOR PANEL
   ====================== */
.calculator-tools {
    display: grid;
    gap: 2rem;
}

.tool-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.tool-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.calculator-form {
    display: grid;
    gap: 1.5rem;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.calculator-result {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 1rem;
    border: 1px solid var(--border-color);
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

.result-item:last-child {
    border-bottom: none;
    font-weight: 600;
    color: var(--primary-color);
}

/* ======================
   SIDEBAR
   ====================== */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-section {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255,255,255,0.2);
}

.sidebar-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.history-list,
.saved-pairs {
    max-height: 200px;
    overflow-y: auto;
}

.no-history,
.no-saved {
    text-align: center;
    color: var(--text-secondary);
    padding: 1rem;
}

.no-history i,
.no-saved i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.clear-history-btn {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--danger-color);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--danger-color);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.clear-history-btn:hover {
    background: var(--danger-color);
    color: white;
}

.settings-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.setting-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.market-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.info-label {
    color: var(--text-secondary);
}

.info-value {
    font-weight: 500;
    color: var(--text-primary);
}

/* ======================
   SUCCESS MESSAGE
   ====================== */
.success-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-xl);
    text-align: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.success-message.show {
    opacity: 1;
    visibility: visible;
}

.success-icon {
    font-size: 4rem;
    color: var(--success-color);
    margin-bottom: 1rem;
}

.success-message h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.success-message p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.success-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.success-btn {
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-md);
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.success-btn.secondary {
    background: transparent;
    color: var(--primary-color);
}

.success-btn:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.success-btn.secondary:hover {
    background: var(--primary-color);
    color: white;
}

/* ======================
   NOTIFICATION SYSTEM
   ====================== */
.notification-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notification {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--info-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 300px;
    animation: slideIn 0.3s ease-out;
}

.notification.success {
    border-left-color: var(--success-color);
}

.notification.error {
    border-left-color: var(--danger-color);
}

.notification.warning {
    border-left-color: var(--warning-color);
}

.notification-icon {
    font-size: 1.25rem;
}

.notification.success .notification-icon {
    color: var(--success-color);
}

.notification.error .notification-icon {
    color: var(--danger-color);
}

.notification.warning .notification-icon {
    color: var(--warning-color);
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 500;
    color: var(--text-primary);
}

.notification-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.notification-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ======================
   RESPONSIVE DESIGN
   ====================== */
@media (max-width: 1200px) {
    .tool-page {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .sidebar {
        grid-row: 1;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .tool-page {
        padding: 1rem;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    
    .header-stats {
        justify-content: center;
    }
    
    .template-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .tab-navigation {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1;
        min-width: 120px;
    }
    
    .tab-btn span {
        display: none;
    }
    
    .currency-group {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .swap-btn {
        justify-self: center;
        transform: rotate(90deg);
    }
    
    .result-amount {
        font-size: 2rem;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .exchange-info {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .conversion-actions {
        flex-direction: column;
    }
    
    .pairs-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .chart-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .input-row {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        grid-template-columns: 1fr;
    }
    
    .notification-container {
        top: 1rem;
        right: 1rem;
        left: 1rem;
    }
    
    .notification {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .tool-header {
        padding: 1.5rem;
    }
    
    .header-text h1 {
        font-size: 2rem;
    }
    
    .header-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .template-grid {
        grid-template-columns: 1fr;
    }
    
    .tab-content {
        padding: 1rem;
    }
    
    .conversion-panel {
        padding: 1.5rem;
    }
    
    .result-amount {
        font-size: 1.5rem;
    }
    
    .sidebar-section {
        padding: 1rem;
    }
}

/* ======================
   DARK MODE SUPPORT
   ====================== */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f8fafc;
        --text-secondary: #cbd5e1;
        --text-muted: #64748b;
        
        --bg-primary: #1e293b;
        --bg-secondary: #334155;
        --bg-tertiary: #475569;
        --bg-dark: #0f172a;
        
        --border-color: #475569;
        --border-light: #334155;
    }
    
    body {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    }
    
    .tool-header,
    .template-card,
    .converter-container,
    .sidebar-section {
        background: rgba(30, 41, 59, 0.95);
        border-color: rgba(71, 85, 105, 0.3);
    }
    
    .template-card:hover {
        background: rgba(51, 65, 85, 0.95);
    }
    
    .tab-btn.active {
        background: var(--bg-primary);
    }
}

/* ======================
   PRINT STYLES
   ====================== */
@media print {
    .tool-page {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .sidebar,
    .tab-navigation,
    .template-section,
    .notification-container {
        display: none;
    }
    
    .tab-content {
        display: block !important;
    }
    
    .converter-container {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
    
    .conversion-panel {
        break-inside: avoid;
    }
}

/* ======================
   ACCESSIBILITY
   ====================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for better accessibility */
button:focus,
input:focus,
select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0000ff;
        --secondary-color: #008000;
        --danger-color: #ff0000;
        --warning-color: #ff8c00;
        --success-color: #008000;
        
        --border-color: #000000;
        --text-primary: #000000;
        --text-secondary: #333333;
    }
    
    .template-card,
    .converter-container,
    .sidebar-section {
        border: 2px solid var(--border-color);
    }
}