/* CSS Custom Properties */
:root {
    --primary-color: #154E9B;
    --secondary-color: #4784F1;
    --text-dark: #1a1a1a;
    --text-light: #6b7280;
    --text-muted: #9ca3af;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --border-color: #e5e7eb;
    --border-focus: #3b82f6;
    --success-color: #10b981;
    --error-color: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Disable selection on all elements */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Disable image dragging and saving */
img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

/* Hide text selection cursor */
::selection {
    background: transparent;
}

::-moz-selection {
    background: transparent;
}

/* Allow interaction with form inputs only */
input, select, textarea {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
    pointer-events: auto !important;
}

/* Prevent console access messages */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-light) 0%, #ffffff 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    /* Disable text selection and context menu */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Disable drag and drop */
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    /* Disable highlighting */
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* Container */
.container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation Bar */
.navbar {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 1rem 2rem;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-logo {
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    backdrop-filter: blur(10px);
}

.nav-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.025em;
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    position: relative;
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -0.25rem;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: white;
    border-radius: 1px;
}

/* Header */
.header {
    text-align: center;
    padding: 3rem 1rem 2rem;
    margin-top: 0;
    background: linear-gradient(135deg, rgba(21, 78, 155, 0.05), rgba(71, 132, 241, 0.05));
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    animation: fadeInDown 0.8s ease;
}

.header-title {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.header-subtitle {
    font-size: 1rem;
    color: var(--text-light);
    font-weight: 400;
    line-height: 1.5;
    max-width: 400px;
    margin: 0 auto;
}

/* Main Content Row Layout */
.main-content-row {
    display: flex;
    gap: 1.5rem;
    margin: 2rem 0 0;
    padding: 0 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    box-sizing: border-box;
}

@media (max-width: 1200px) {
    .main-content-row {
        flex-direction: column;
        width: 100%;
        margin-left: 0;
        padding: 0 1rem;
    }
}

/* Converter Card */
.converter-card {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    animation: fadeInUp 0.8s ease 0.2s both;
    position: relative;
    overflow: hidden;
    flex: 1;
    min-width: 300px;
    min-height: 500px;
    display: flex;
    flex-direction: column;
}

@media (max-width: 1200px) {
    .converter-card {
        flex: 1;
        width: 100%;
        margin: 0;
        min-width: 300px;
    }
}

.converter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.converter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.converter-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

.swap-btn {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-light);
}

.swap-btn:hover {
    background: var(--secondary-color);
    color: white;
    transform: rotate(180deg) scale(1.05);
    border-color: var(--secondary-color);
}

/* Form Elements */
.converter-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex: 1;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.amount-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 1.125rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    background: var(--bg-white);
    font-family: inherit;
}

.amount-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(71, 132, 241, 0.1);
}

.amount-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

/* Currency Grid */
.currency-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.currency-select-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Custom Select */
.custom-select {
    position: relative;
}

.select-trigger {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-white);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
}

.select-trigger:hover {
    border-color: var(--secondary-color);
}

.select-trigger.active {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(71, 132, 241, 0.1);
}

.selected-currency {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.currency-flag {
    font-size: 1.25rem;
}

.currency-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
}

.currency-code {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-dark);
}

.currency-name {
    font-size: 0.75rem;
    color: var(--text-light);
    line-height: 1;
}

.select-arrow {
    transition: transform var(--transition-fast);
    color: var(--text-light);
}

.select-trigger.active .select-arrow {
    transform: rotate(180deg);
}

/* Dropdown */
.select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 300px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
}

.select-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-search {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-search input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: inherit;
}

.dropdown-search input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.dropdown-options {
    max-height: 200px;
    overflow-y: auto;
}

.dropdown-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.dropdown-option:hover {
    background-color: var(--bg-light);
}

.dropdown-option.selected {
    background-color: rgba(71, 132, 241, 0.1);
    color: var(--secondary-color);
}

/* Convert Button */
.convert-btn {
    width: 100%;
    padding: 1.25rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    font-family: inherit;
    margin-top: 0.5rem;
}

.convert-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.convert-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(21, 78, 155, 0.3);
}

.convert-btn:hover::before {
    left: 100%;
}

.convert-btn:active {
    transform: translateY(0);
}

.convert-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.convert-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

.btn-text {
    transition: opacity var(--transition-fast);
}

.btn-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.convert-btn.loading .btn-text {
    opacity: 0;
}

.convert-btn.loading .btn-loader {
    opacity: 1;
}

/* Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Result Card */
.result-card {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all var(--transition-slow);
    flex: 1;
    min-width: 300px;
    min-height: 500px;
    display: flex;
    flex-direction: column;
}

@media (max-width: 1200px) {
    .result-card {
        width: 100%;
        margin: 0;
        flex: 1;
        min-width: 300px;
    }
}

.result-card.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.result-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
}

.result-timestamp {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.result-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--success-color);
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
    border-radius: var(--radius-lg);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.result-rate {
    text-align: center;
    color: var(--text-light);
    font-size: 0.875rem;
    padding: 0.5rem;
    background: var(--bg-light);
    border-radius: var(--radius-md);
}

/* Historical Chart Card */
.chart-card {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all var(--transition-slow);
    flex: 1;
    min-width: 300px;
    min-height: 500px;
    display: flex;
    flex-direction: column;
}

@media (max-width: 1200px) {
    .chart-card {
        width: 100%;
        margin: 0;
        min-width: 300px;
        flex: 1;
    }
}

.chart-card.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.chart-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
}

.chart-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.chart-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    color: var(--text-dark);
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.chart-select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(71, 132, 241, 0.1);
}

.chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 1rem;
}

.chart-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

.chart-loading.hidden {
    display: none;
}

/* Error Message */
.error-message {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin: 2rem 1rem 0;
    border: 1px solid var(--error-color);
    background-color: rgba(239, 68, 68, 0.05);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
}

.error-message.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.error-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--error-color);
    font-size: 0.875rem;
}

/* Footer */
.footer {
    margin-top: auto;
    background: linear-gradient(135deg, var(--bg-light), #ffffff);
    border-top: 1px solid var(--border-color);
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    padding: 3rem 2rem 1rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.footer-section {
    text-align: left;
}

.footer-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.footer-subtitle {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
}

.footer-description {
    font-size: 0.875rem;
    color: var(--text-light);
    line-height: 1.5;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    position: relative;
    padding-left: 1rem;
}

.footer-links li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
}

.footer-api {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.footer-update {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    text-align: center;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

.footer-bottom p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 640px) {
    .navbar {
        padding: 1rem;
    }
    
    .nav-content {
        padding: 0 1rem;
    }
    
    .nav-menu {
        gap: 1rem;
    }
    
    .nav-link {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .nav-title {
        font-size: 1.1rem;
    }
    
    .nav-logo {
        font-size: 1.25rem;
        padding: 0.375rem;
    }
    
    .header {
        padding: 2rem 1rem 1.5rem;
        margin-top: 0;
    }
    
    .converter-card {
        padding: 1.5rem;
    }
    
    .header-title {
        font-size: 1.875rem;
    }
    
    .currency-grid {
        grid-template-columns: 1fr;
    }
    
    .converter-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .swap-btn {
        align-self: center;
    }
    
    .footer {
        padding: 2rem 1rem 1rem;
    }
    
    .footer-content {
        gap: 1.5rem;
        margin-bottom: 1.5rem;
        grid-template-columns: 1fr;
        padding: 0 1rem;
    }
    
    .footer-section {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .currency-info {
        display: none;
    }
    
    .selected-currency {
        gap: 0.5rem;
    }
    
    .currency-code {
        font-size: 1rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for better accessibility */
button:focus-visible,
input:focus-visible,
.select-trigger:focus-visible {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-light: #000000;
        --text-muted: #000000;
    }
}
