@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 0 32px 64px rgba(0, 0, 0, 0.5), 0 8px 16px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    border: 1px solid rgba(100, 116, 139, 0.2);
}

header {
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 50%, #14b8a6 100%);
    color: white;
    padding: 48px 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
    pointer-events: none;
}

header h1 {
    font-size: 2.75rem;
    margin-bottom: 12px;
    font-weight: 800;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 1;
}

header p {
    font-size: 1.125rem;
    opacity: 0.95;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 600px;
}

.calculator {
    padding: 48px 40px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.6) 0%, rgba(30, 41, 59, 0.8) 100%);
    border-right: 1px solid rgba(100, 116, 139, 0.3);
}

.input-section {
    margin-bottom: 40px;
    background: rgba(51, 65, 85, 0.5);
    border-radius: 16px;
    padding: 32px;
    border: 1px solid rgba(100, 116, 139, 0.3);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.input-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
    background: rgba(51, 65, 85, 0.6);
}

.input-section h2 {
    color: #e2e8f0;
    font-size: 1.375rem;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(100, 116, 139, 0.4);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.input-group {
    margin-bottom: 24px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #cbd5e0;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid rgba(71, 85, 105, 0.5);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    color: #f1f5f9;
}

.input-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 20px;
    padding-right: 48px;
}

.input-group select option {
    background: #1e293b;
    color: #f1f5f9;
    padding: 12px;
}

.category-search-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
}

.category-search {
    width: 100%;
    padding: 14px 20px;
    padding-left: 44px;
    border: 2px solid rgba(71, 85, 105, 0.5);
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    color: #f1f5f9;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3ccircle cx='11' cy='11' r='8'%3e%3c/circle%3e%3cpath d='m21 21-4.35-4.35'%3e%3c/path%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 14px center;
    background-size: 20px;
}

.category-search::placeholder {
    color: #94a3b8;
}

.category-search:focus {
    outline: none;
    border-color: #06b6d4;
    background-color: rgba(51, 65, 85, 0.8);
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.2), 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2306b6d4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3ccircle cx='11' cy='11' r='8'%3e%3c/circle%3e%3cpath d='m21 21-4.35-4.35'%3e%3c/path%3e%3c/svg%3e");
}

.category-search-wrapper select {
    min-height: 180px;
    max-height: 220px;
    overflow-y: auto;
    padding: 12px;
    background-image: none !important;
    padding-right: 12px !important;
    border: 2px solid rgba(71, 85, 105, 0.5);
    border-radius: 12px;
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-search-wrapper select:focus {
    border-color: #06b6d4;
    background: rgba(51, 65, 85, 0.9);
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.2), 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Custom scrollbar for category list */
.category-search-wrapper select::-webkit-scrollbar {
    width: 8px;
}

.category-search-wrapper select::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.6);
    border-radius: 10px;
    margin: 8px 0;
}

.category-search-wrapper select::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    border-radius: 10px;
    transition: background 0.3s ease;
}

.category-search-wrapper select::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #06b6d4 0%, #14b8a6 100%);
}

.category-search-wrapper select option {
    padding: 12px 14px;
    margin: 4px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(30, 41, 59, 0.4);
    color: #cbd5e0;
    font-weight: 500;
}

.category-search-wrapper select option:hover {
    background: rgba(6, 182, 212, 0.25);
    color: #f1f5f9;
    transform: translateX(4px);
}

.category-search-wrapper select option:checked,
.category-search-wrapper select option:focus {
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.4);
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #06b6d4;
    background: rgba(51, 65, 85, 0.8);
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.2), 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

.input-group input:hover:not([readonly]),
.input-group select:hover {
    border-color: rgba(100, 116, 139, 0.7);
    transform: translateY(-1px);
    background: rgba(51, 65, 85, 0.7);
}

.input-group input[readonly] {
    background: rgba(15, 23, 42, 0.6);
    color: #94a3b8;
    cursor: not-allowed;
    border-color: rgba(71, 85, 105, 0.4);
}

.cost-note {
    display: block;
    margin-top: 8px;
    font-size: 0.85rem;
    color: #94a3b8;
    font-style: italic;
    font-weight: 400;
}

.fee-type-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.toggle-btn {
    flex: 1;
    padding: 10px 16px;
    background: rgba(30, 41, 59, 0.6);
    color: #cbd5e0;
    border: 2px solid rgba(71, 85, 105, 0.5);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    background: rgba(51, 65, 85, 0.7);
    border-color: rgba(100, 116, 139, 0.7);
}

.toggle-btn.active {
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    color: white;
    border-color: #06b6d4;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

.fee-note {
    display: block;
    margin-top: 8px;
    font-size: 0.85rem;
    color: #94a3b8;
    font-style: italic;
    font-weight: 400;
}

.calculate-btn {
    width: 100%;
    padding: 20px 24px;
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 50%, #14b8a6 100%);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 32px;
    margin-bottom: 0;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(6, 182, 212, 0.4);
}

.calculate-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.5s;
}

.calculate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 40px rgba(6, 182, 212, 0.6);
}

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

.calculate-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(6, 182, 212, 0.5);
}

.export-section {
    margin-top: 32px;
    padding-top: 32px;
    border-top: 2px solid rgba(100, 116, 139, 0.3);
}

.export-section h3 {
    color: #e2e8f0;
    font-size: 1.25rem;
    margin-bottom: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.export-wrapper {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.export-filename {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid rgba(71, 85, 105, 0.5);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    color: #f1f5f9;
}

.export-filename:focus {
    outline: none;
    border-color: #06b6d4;
    background: rgba(51, 65, 85, 0.8);
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.2), 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

.export-filename:hover {
    border-color: rgba(100, 116, 139, 0.7);
    transform: translateY(-1px);
    background: rgba(51, 65, 85, 0.7);
}

.export-filename::placeholder {
    color: #94a3b8;
}

.export-btn {
    padding: 16px 32px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
    white-space: nowrap;
}

.export-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.5s;
}

.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.6);
}

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

.export-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.5);
}

.export-btn:disabled {
    background: rgba(71, 85, 105, 0.5);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

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

.results {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.6) 0%, rgba(30, 41, 59, 0.8) 100%);
    padding: 48px 40px;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
}

.results h2 {
    color: #f1f5f9;
    font-size: 1.625rem;
    margin-bottom: 32px;
    text-align: center;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.result-grid {
    display: grid;
    gap: 20px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: rgba(51, 65, 85, 0.5);
    border-radius: 16px;
    border-left: 4px solid #06b6d4;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    border: 1px solid rgba(100, 116, 139, 0.3);
}

.result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    background: rgba(51, 65, 85, 0.6);
}

.result-item.profit {
    border-left-color: #10b981;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.15) 100%);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.result-item.margin {
    border-left-color: #eab308;
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.15) 0%, rgba(202, 138, 4, 0.15) 100%);
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.result-item.recommendation {
    border-left-color: #f59e0b;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(251, 146, 60, 0.15) 100%);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.result-label {
    font-weight: 500;
    color: #cbd5e0;
    font-size: 1rem;
    letter-spacing: 0.01em;
}

.result-value {
    font-weight: 700;
    color: #f1f5f9;
    font-size: 1.125rem;
    letter-spacing: -0.01em;
}

.result-item.profit .result-value {
    color: #6ee7b7;
    font-size: 1.25rem;
    font-weight: 800;
}

.result-item.margin .result-value {
    color: #fde047;
    font-size: 1.25rem;
    font-weight: 800;
}

.result-item.recommendation .result-value {
    color: #fbbf24;
    font-size: 1.25rem;
    font-weight: 800;
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .calculator {
        border-right: none;
        border-bottom: 1px solid rgba(100, 116, 139, 0.3);
    }
    
    .results {
        min-height: auto;
    }
}

.footer {
    text-align: center;
    padding: 24px 20px;
    background: rgba(15, 23, 42, 0.8);
    border-top: 1px solid rgba(100, 116, 139, 0.3);
    margin-top: 20px;
}

.footer p {
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0;
    letter-spacing: 0.02em;
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }
    
    .container {
        margin: 0;
        border-radius: 20px;
    }
    
    header {
        padding: 32px 24px;
    }
    
    header h1 {
        font-size: 2.25rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    .calculator {
        padding: 32px 24px;
    }
    
    .input-section {
        padding: 24px;
        margin-bottom: 32px;
    }
    
    .input-section h2 {
        font-size: 1.25rem;
    }
    
    .input-group input {
        padding: 14px 18px;
    }
    
    .calculate-btn {
        padding: 18px 20px;
        font-size: 1.0625rem;
        margin-top: 24px;
        margin-bottom: 0;
    }
    
    .results {
        padding: 32px 24px;
    }
    
    .results h2 {
        font-size: 1.5rem;
    }
    
    .result-item {
        padding: 16px 20px;
    }
    
    .result-label {
        font-size: 0.9375rem;
    }
    
    .result-value {
        font-size: 1.0625rem;
    }
    
    .result-item.profit .result-value,
    .result-item.recommendation .result-value {
        font-size: 1.125rem;
    }
}
