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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.95;
}

.main-content {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
    padding: 30px;
}

.input-panel {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.input-panel h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.input-section {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.input-section:last-child {
    border-bottom: none;
}

.section-title {
    color: #764ba2;
    font-size: 1.1em;
    margin-bottom: 15px;
    font-weight: 700;
}

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

.info-text {
    font-size: 0.75em;
    color: #888;
    font-style: italic;
    margin-top: 4px;
}

.input-group label {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.label-text {
    font-weight: 600;
    color: #555;
    font-size: 0.95em;
}

.input-group input,
.input-group select {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    width: 100%;
}

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

.unit {
    font-size: 0.85em;
    color: #888;
    margin-top: 4px;
}

.calculate-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

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

.visual-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.visual-panel h2 {
    color: #667eea;
    font-size: 1.8em;
    margin-bottom: 10px;
}

.visual-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.canvas-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.calc-details-btn, .zoom-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.calc-details-btn:hover, .zoom-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.zoom-info {
    font-size: 0.85em;
    color: #666;
    font-style: italic;
}

.canvas-container {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.canvas-wrapper {
    position: relative;
    overflow: auto;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: white;
    cursor: grab;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-height: 900px;
    touch-action: none;
    -webkit-overflow-scrolling: touch;
}

.canvas-wrapper:active {
    cursor: grabbing;
}

.canvas-wrapper::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

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

.canvas-wrapper::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.canvas-wrapper::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

#tankCanvas {
    display: block;
    max-width: 100%;
    height: auto;
    transition: transform 0.1s ease-out;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.results-panel {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.results-panel h3 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.result-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.result-item.highlight {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border: 2px solid #667eea;
}

.canvas-title {
    margin-top: 10px;
    font-weight: 600;
    color: #667eea;
    font-size: 1.1em;
}

.result-label {
    font-weight: 600;
    color: #555;
}

.result-value {
    font-weight: 700;
    color: #667eea;
    font-size: 1.1em;
}

footer {
    background: #2d3748;
    color: white;
    text-align: center;
    padding: 20px;
    font-size: 0.9em;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .input-panel {
        position: relative;
        top: 0;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: white;
    margin: 3% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: slideDown 0.3s ease;
}

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

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

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.close-modal {
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    color: white;
    transition: transform 0.2s ease;
}

.close-modal:hover {
    transform: scale(1.2);
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.calculation-step {
    background: #f8f9fa;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.calculation-step h4 {
    color: #667eea;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.calculation-step .formula {
    font-family: 'Courier New', monospace;
    background: white;
    padding: 10px;
    border-radius: 5px;
    margin: 8px 0;
    border: 1px solid #ddd;
}

.calculation-step .result {
    font-weight: 700;
    color: #764ba2;
    margin-top: 8px;
    font-size: 1.05em;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .visual-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .canvas-controls {
        flex-direction: column;
        width: 100%;
    }
    
    .zoom-info {
        width: 100%;
        text-align: left;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
        max-height: 90vh;
    }
}
