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

body {
    font-family: 'Inter', sans-serif;
    background-color: #efefef;
    color: #333;
    line-height: 1.6;
}

.container {
    display: flex;
    min-height: 100vh;
    gap: 20px;
    padding: 20px;
    max-width: 1800px;
    margin: 0 auto;
}

/* Левая панель */
.left-panel {
    flex: 0 0 400px;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.left-panel h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 30px;
    color: #1a1a1a;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #555;
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #007bff;
}

/* Информация о паре */
.pair-info {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    margin-top: 8px;
    border: 1px solid #e9ecef;
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 13px;
}

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

.info-item span:first-child {
    color: #666;
    font-weight: 500;
}

.info-item span:last-child {
    color: #1a1a1a;
    font-weight: 600;
}

/* Toggle группы */
.toggle-group {
    display: flex;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.toggle-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: white;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn.active {
    background: #007bff;
    color: white;
}

.toggle-btn:hover:not(.active) {
    background: #f8f9fa;
}

/* Цветные кнопки Direction */
.direction-btn.active[data-value="long"] {
    background: #28a745;
    color: white;
}

.direction-btn.active[data-value="short"] {
    background: #dc3545;
    color: white;
}

/* Тумблер в стиле iPhone */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-label {
    position: relative;
    display: block;
    width: 60px;
    height: 34px;
    background-color: #ccc;
    border-radius: 34px;
    cursor: pointer;
    transition: 0.3s;
}

.toggle-label:hover {
    background-color: #bbb;
}

.toggle-switch input:checked + .toggle-label {
    background-color: #007bff;
}

.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 30px;
    height: 30px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-label .toggle-slider {
    transform: translateX(26px);
}

.toggle-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 600;
    color: white;
    pointer-events: none;
}

/* Секции */
.section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #1a1a1a;
}

/* Рассчитанные значения */
.calculated-values {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.calc-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

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

.calc-item span:first-child {
    color: #666;
}

.calc-item span:last-child {
    font-weight: 500;
    color: #1a1a1a;
}

/* Calculate Button */
.calculate-btn {
    width: 100%;
    padding: 15px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 30px;
    transition: background-color 0.2s;
}

.calculate-btn:hover {
    background: #218838;
}

/* Results */
.results-section {
    margin-top: 20px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.parameters-container {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
}

.parameters-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    grid-template-rows: repeat(2, auto);
}

/* Responsive design */
@media (max-width: 1200px) {
    .parameters-grid {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(3, auto);
    }
}

@media (max-width: 900px) {
    .parameters-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(4, auto);
    }
}

@media (max-width: 600px) {
    .parameters-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(5, auto);
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 12px;
    font-weight: 500;
    color: #6c757d;
    margin: 0;
}

.result-value {
    padding: 6px 10px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-weight: 600;
    color: #333;
    min-height: 14px;
    font-size: 13px;
    text-align: right;
}

.results-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #1a1a1a;
}

.results-grid {
    display: grid;
    gap: 12px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 14px;
}

.result-item span:first-child {
    color: #666;
}

.result-item span:last-child {
    font-weight: 500;
    color: #1a1a1a;
}



/* Right Panel */
.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}



/* Charts Section */
.charts-section {
    background: #efefef;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.charts-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #1a1a1a;
    font-family: 'Inter', sans-serif;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.chart-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chart-container h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #1a1a1a;
    font-family: 'Inter', sans-serif;
}

.chart-container canvas {
    width: 100% !important;
    height: 300px !important;
}

/* Table */
.table-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-height: 600px;
    overflow-y: auto;
}

.table-container h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #1a1a1a;
}

.table-wrapper {
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

th, td {
    padding: 8px 12px;
    text-align: right;
    border-bottom: 1px solid #eee;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    position: sticky;
    top: 0;
    z-index: 10;
}

td {
    color: #333;
}

tr:hover {
    background: #f8f9fa;
}

/* Графики */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.chart-wrapper {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chart-wrapper h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #1a1a1a;
}

.chart-wrapper canvas {
    width: 100% !important;
    height: 200px !important;
}

/* Адаптивность */
@media (max-width: 1400px) {
    .container {
        flex-direction: column;
    }
    
    .left-panel,
    .middle-panel {
        position: static;
        flex: none;
    }
    
    .charts-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .left-panel,
    .table-container,
    .chart-wrapper {
        padding: 15px;
    }
    
    .left-panel h1 {
        font-size: 20px;
    }
    
    table {
        font-size: 11px;
    }
    
    th, td {
        padding: 6px 8px;
    }
}

/* Скроллбар для таблицы */
.table-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

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

/* Grid Step Visual */
.grid-step-visual-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

.grid-step-visual-container h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #1a1a1a;
}

.grid-step-chart {
    background: white;
    border-radius: 8px;
    padding: 20px;
    min-height: 500px;
    max-height: 750px;
    position: relative;
    overflow: hidden;
}

.grid-step-line {
    position: absolute;
    height: 2px;
    background: #2ecc71;
    border-radius: 1px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: #333;
    transition: all 0.3s ease;
}

.grid-step-line:hover {
    background: #27ae60;
    height: 3px;
}

.grid-step-label {
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    white-space: nowrap;
    font-size: 10px;
    color: #999;
}





.grid-step-y-axis {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 60px;
    background: rgba(255, 255, 255, 0.8);
    border-right: 1px solid #ddd;
    padding: 10px 5px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    color: #666;
}

.grid-step-y-label {
    text-align: center;
    font-weight: 500;
}

/* Coffee Link Styles */
.coffee-link-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.coffee-link {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 14px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

.coffee-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
    color: white;
    text-decoration: none;
}

/* Coffee Modal Styles */
.coffee-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.coffee-modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.coffee-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 15px;
    right: 20px;
    transition: color 0.3s ease;
}

.coffee-close:hover {
    color: #333;
}

.coffee-modal-content h3 {
    margin-top: 0;
    margin-bottom: 25px;
    color: #333;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    text-align: center;
}

.address-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.address-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.address-item strong {
    color: #333;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14px;
}

.address {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    color: #666;
    word-break: break-all;
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.copy-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
    align-self: flex-start;
}

.copy-btn:hover {
    background: #5a6fd8;
}

.copy-btn:active {
    transform: scale(0.98);
}

/* Responsive design for modal */
@media (max-width: 600px) {
    .coffee-modal-content {
        margin: 20% auto;
        width: 95%;
        padding: 20px;
    }
    
    .coffee-link {
        padding: 10px 16px;
        font-size: 13px;
    }
}
