/* RMB Converter Custom Styles */

/* Use system CSS variables to avoid conflicts */
body {
    background-color: var(--surface-color, #f8fafc);
}

/* Remove generic header styles to avoid conflicts with system styles */

/* Card Styles */
.card {
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
}

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

/* Button Group Styles */
.btn-group .btn {
    font-size: 0.875rem;
}

/* Form Controls */
.form-control, .form-select {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    border-radius: 0.375rem;
}

#numberInput, #chineseInput, #batchInput, #batchOutput {
    resize: vertical;
    line-height: 1.5;
}

#batchInput, #batchOutput {
    font-size: 0.875rem;
    background-color: #f8f9fa;
    border: 1px solid #e2e8f0;
}

#batchOutput {
    background-color: #ffffff;
    color: #495057;
}

/* Chinese Result Display */
.chinese-result {
    font-family: 'KaiTi', '楷体', 'STKaiti', '华文楷体', serif;
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary-color, #0d6efd);
    min-height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    word-break: break-all;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.chinese-result:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.chinese-result.empty {
    background: #f8f9fa;
    color: #6c757d;
    font-size: 1.2rem;
    font-family: var(--font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}

/* Number Result Display */
.number-result {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: var(--success-color, #198754);
    min-height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.3);
    transition: all 0.3s ease;
}

.number-result:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(17, 153, 142, 0.4);
}

.number-result.empty {
    background: #f8f9fa;
    color: #6c757d;
    font-size: 1.2rem;
    font-family: var(--font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}

/* Quick Amounts */
.quick-amounts {
    margin-top: 1.5rem;
}

.quick-amounts .btn-group {
    flex-wrap: wrap;
}

/* Format Options */
.format-options {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 0.375rem;
    margin-top: 1rem;
}

.format-options h6 {
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
}

/* Examples */
.examples {
    margin-top: 1.5rem;
}

.example-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.example-buttons .btn {
    font-size: 0.75rem;
}

/* Result Actions */
.result-actions {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 0.375rem;
    margin-top: 1rem;
}

/* Statistics */
.stat-item {
    padding: 1rem 0;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color, #0d6efd);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Conversion History */
.conversion-history {
    margin-top: 1.5rem;
}

.conversion-history h6 {
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
    background: #f8f9fa;
    padding: 0.5rem;
    border-radius: 0.25rem;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: white;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-number {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    color: var(--primary-color, #0d6efd);
}

.history-chinese {
    font-family: 'KaiTi', '楷体', 'STKaiti', '华文楷体', serif;
    color: var(--success-color, #198754);
    flex: 1;
    margin: 0 1rem;
    text-align: center;
}

.history-time {
    color: var(--text-secondary, #64748b);
    font-size: 0.75rem;
}

/* Validation Info */
.validation-info {
    margin-top: 1rem;
}

.validation-info .alert {
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

/* Analysis Results */
.analysis-results {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 0.375rem;
    margin-top: 1rem;
}

.analysis-results h6 {
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.analysis-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: white;
    border-radius: 0.25rem;
    border: 1px solid #e2e8f0;
}

.analysis-label {
    font-weight: 500;
    color: var(--text-secondary, #64748b);
}

.analysis-value {
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* Status Bar */
.alert {
    border-radius: 0.5rem;
}

.alert-success {
    background-color: #d1e7dd;
    border-color: #badbcc;
    color: #0f5132;
}

.alert-warning {
    background-color: #fff3cd;
    border-color: #ffecb5;
    color: #664d03;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c2c7;
    color: #721c24;
}

.alert-info {
    background-color: #cff4fc;
    border-color: #b6effb;
    color: #055160;
}

/* Loading Animation */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-color, #0d6efd);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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

/* Copy Button Animation */
.copy-success {
    animation: copyPulse 0.6s ease;
}

@keyframes copyPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Hero Actions */
.hero-actions {
    margin-top: 1.5rem;
}

.hero-actions .btn {
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Batch Conversion */
.batch-conversion {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .oidn-container {
        padding: 0 0.5rem;
    }

    .card-body .row {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-group {
        flex-wrap: wrap;
        justify-content: center;
    }

    .btn-group .btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    .stat-item {
        padding: 0.5rem 0;
    }

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

    .chinese-result,
    .number-result {
        font-size: 1.5rem;
        min-height: 2.5rem;
    }

    .example-buttons {
        flex-direction: column;
    }

    .analysis-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .history-item {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .history-time {
        font-size: 0.7rem;
    }
}

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

/* Focus Styles */
.btn:focus,
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color, #0d6efd);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #ffffff;
    }

    .card {
        background-color: #2d2d2d;
        border-color: #404040;
    }

    .form-control,
    .form-select {
        background-color: #3d3d3d;
        border-color: #404040;
        color: #ffffff;
    }

    #batchInput,
    #batchOutput {
        background-color: #3d3d3d;
        border-color: #404040;
        color: #ffffff;
    }

    .format-options,
    .result-actions,
    .analysis-results {
        background-color: #2d2d2d;
    }

    .history-list {
        background-color: #2d2d2d;
    }

    .history-item {
        background-color: #3d3d3d;
        border-color: #404040;
    }

    .analysis-item {
        background-color: #3d3d3d;
        border-color: #404040;
    }
}

/* Print Styles */
@media print {
    header,
    .card-header,
    .card-footer,
    .btn-group,
    .alert,
    .modal,
    .hero-actions {
        display: none !important;
    }

    .oidn-container {
        max-width: none;
        padding: 0;
    }

    .row.g-3 {
        gap: 0;
    }

    .col-lg-6,
    .col-md-6 {
        width: 100%;
        page-break-inside: avoid;
    }

    .chinese-result,
    .number-result {
        border: 1px solid #000;
        page-break-inside: avoid;
    }
}

/* Custom animations */
.fade-in {
    animation: fadeIn 0.6s ease-out;
}

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

.slide-in {
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Text utilities */
.text-chinese {
    font-family: 'KaiTi', '楷体', 'STKaiti', '华文楷体', serif;
}

.text-mono {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* Border utilities */
.border-gradient {
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, #667eea 0%, #764ba2 100%) border-box;
    border: 2px solid transparent;
}

/* Badge styles */
.badge-chinese {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-family: 'KaiTi', '楷体', 'STKaiti', '华文楷体', serif;
}

.badge-number {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}