/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.header-content {
    text-align: center;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo .material-icons {
    font-size: 48px;
    color: #667eea;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-subtitle {
    font-size: 1.1rem;
    color: #666;
    font-weight: 400;
    margin-bottom: 15px;
}

/* Language Toggle */
.language-toggle {
    position: absolute;
    top: 0;
    right: 0;
}

.language-toggle .btn {
    padding: 8px 16px;
    font-size: 12px;
    border-radius: 20px;
}

#currentLang {
    font-weight: 600;
}

/* Control Panel */
.control-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-group label {
    font-weight: 500;
    color: #555;
    white-space: nowrap;
}

.setting-group select,
.setting-group input {
    padding: 8px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    transition: all 0.2s ease;
}

.setting-group select:focus,
.setting-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Token Input Styling */
.token-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.token-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.token-input-container input {
    flex: 1;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
}

.token-input-container .btn {
    padding: 8px 12px;
    min-width: auto;
}

.token-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    margin-top: 5px;
}

.token-status.valid {
    color: #22c55e;
}

.token-status.invalid {
    color: #ef4444;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f8f9fa;
    color: #666;
    border: 2px solid #e1e5e9;
}

.btn-secondary:hover:not(:disabled) {
    background: #e9ecef;
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Progress Section */
.progress-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.live {
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: white;
}

.stat-icon.dead {
    background: linear-gradient(135deg, #f87171, #ef4444);
    color: white;
}

.stat-icon.ineligible {
    background: linear-gradient(135deg, #e879f9, #d946ef);
    color: white;
}

.stat-icon.total {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    color: white;
}

.stat-icon.rate {
    background: linear-gradient(135deg, #a78bfa, #8b5cf6);
    color: white;
}

.stat-icon.duplicates {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Duplicate Details Section */
.duplicate-details {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-left: 4px solid #f59e0b;
}

.duplicate-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.duplicate-header h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #f59e0b;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.duplicate-header .material-icons {
    font-size: 20px;
}

.duplicate-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.duplicate-item {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 8px;
    padding: 10px 12px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #92400e;
    word-break: break-all;
    transition: all 0.3s ease;
}

.duplicate-item:hover {
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.4);
    transform: translateY(-1px);
}

.progress-bar-container {
    margin-top: 20px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.progress-bar {
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

/* Filter Section */
.filter-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    padding: 10px 15px;
    flex: 1;
    min-width: 250px;
}

.search-box .material-icons {
    color: #666;
    font-size: 20px;
}

.search-box input {
    border: none;
    outline: none;
    flex: 1;
    font-size: 14px;
}

.filter-buttons {
    display: flex;
    gap: 10px;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid #e1e5e9;
    background: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #666;
}

.filter-btn.active,
.filter-btn:hover {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.export-buttons {
    display: flex;
    gap: 10px;
}

/* Results Section */
.results-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.results-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.results-info {
    color: #666;
    font-size: 0.9rem;
}

.results-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #e1e5e9;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.results-table th,
.results-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}

.results-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.results-table tbody tr:hover {
    background: #f8fafc;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.live {
    background: #dcfce7;
    color: #166534;
}

.status-badge.dead {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.ineligible {
    background: #fef0ff;
    color: #86198f;
    border: 1px solid #e879f9;
}

.status-badge.checking {
    background: #fef3c7;
    color: #92400e;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.code-cell {
    font-family: 'Consolas', 'Monaco', monospace;
    font-weight: 600;
    color: #667eea;
}

.details-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.time-cell {
    color: #666;
    font-size: 0.85rem;
}

.actions-cell {
    display: flex;
    gap: 5px;
}

.action-btn {
    padding: 5px 8px;
    border: none;
    background: transparent;
    color: #667eea;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: #f1f5f9;
}

/* Input Section */
.input-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.input-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.input-actions {
    display: flex;
    gap: 10px;
}

.input-container {
    position: relative;
}

.input-container textarea {
    width: 100%;
    padding: 20px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    background: white;
    transition: all 0.2s ease;
}

.input-container textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    color: #666;
    font-size: 0.9rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    border-radius: 10px;
    padding: 15px 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left: 4px solid #22c55e;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast.warning {
    border-left: 4px solid #f59e0b;
}

.toast.info {
    border-left: 4px solid #3b82f6;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    /* Header adjustments */
    .header {
        padding: 20px 15px;
        margin-bottom: 15px;
    }
    
    .logo {
        gap: 10px;
    }
    
    .logo .material-icons {
        font-size: 32px;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .header-subtitle {
        font-size: 0.9rem;
    }
    
    .language-toggle {
        position: static;
        margin-top: 15px;
        display: flex;
        justify-content: center;
    }
    
    /* Control Panel */
    .control-panel {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .settings-row {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .setting-group {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .setting-group label {
        font-size: 13px;
    }
    
    .setting-group select,
    .setting-group input {
        width: 100%;
        font-size: 13px;
    }
    
    /* Buttons */
    .btn {
        padding: 10px 16px;
        font-size: 13px;
        width: 100%;
        justify-content: center;
    }
    
    /* Progress Section */
    .progress-section {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .progress-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .stat-card {
        padding: 12px;
        gap: 10px;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
    }
    
    .stat-icon .material-icons {
        font-size: 20px;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
        line-height: 1.2;
    }
    
    /* Filter Section */
    .filter-section {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .search-box {
        min-width: unset;
        padding: 8px 12px;
    }
    
    .filter-buttons {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .filter-btn {
        padding: 8px 10px;
        font-size: 12px;
        text-align: center;
    }
    
    .export-buttons {
        width: 100%;
        display: flex;
        gap: 8px;
    }
    
    .export-buttons .btn {
        flex: 1;
    }
    
    /* Results Section */
    .results-section {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .results-header h2 {
        font-size: 1.2rem;
    }
    
    .results-table th,
    .results-table td {
        padding: 10px 8px;
        font-size: 12px;
    }
    
    .results-table th {
        font-size: 0.75rem;
    }
    
    .code-cell {
        font-size: 11px;
    }
    
    .details-cell {
        max-width: 150px;
        font-size: 11px;
    }
    
    /* Input Section */
    .input-section {
        padding: 15px;
    }
    
    .input-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .input-header h3 {
        font-size: 1.1rem;
    }
    
    .input-actions {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .input-actions .btn {
        padding: 8px;
        font-size: 11px;
        white-space: normal;
        min-height: 44px;
    }
    
    .input-actions .btn .material-icons {
        font-size: 16px;
    }
    
    .input-container textarea {
        padding: 12px;
        font-size: 12px;
    }
    
    /* Duplicate Details */
    .duplicate-details {
        padding: 12px;
    }
    
    .duplicate-list {
        grid-template-columns: 1fr;
    }
    
    /* Toast */
    .toast-container {
        left: 10px;
        right: 10px;
        top: 10px;
    }
    
    .toast {
        min-width: unset;
        padding: 12px 15px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.3rem;
    }
    
    .header-subtitle {
        font-size: 0.8rem;
    }
    
    .progress-stats {
        grid-template-columns: 1fr;
    }
    
    .filter-buttons {
        grid-template-columns: 1fr;
    }
    
    .filter-btn {
        width: 100%;
    }
    
    .export-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .export-buttons .btn {
        width: 100%;
    }
    
    .input-actions {
        grid-template-columns: 1fr;
    }
    
    .input-actions .btn {
        min-height: unset;
    }
    
    /* Make table scrollable */
    .results-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .results-table {
        min-width: 600px;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Modal Styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #e1e5e9;
}

.modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.3rem;
}

.modal-close {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f1f5f9;
    color: #333;
}

.modal-body {
    padding: 30px;
}

.modal-body p {
    margin-bottom: 20px;
    color: #555;
    line-height: 1.6;
}

.solution {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.solution h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.1rem;
}

.solution ol {
    margin: 0;
    padding-left: 20px;
}

.solution li {
    margin-bottom: 8px;
    color: #555;
}

.solution code {
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    color: #1e293b;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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