:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4cc9f0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --error-color: #f44336;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: var(--dark-color);
    line-height: 1.6;
    padding: 20px;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1.1rem;
}

.calculator-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}

.input-section, .result-section {
    flex: 1;
    min-width: 300px;
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--box-shadow);
}

.mode-selector {
    display: flex;
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: #f0f0f0;
}

.mode-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.mode-btn.active {
    background: var(--primary-color);
    color: white;
}

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

.input-field {
    margin-bottom: 15px;
}

.input-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.input-field input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.input-field input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}

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

.btn {
    padding: 10px 15px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn i {
    font-size: 0.9rem;
}

.btn.primary {
    background-color: var(--primary-color);
    color: white;
}

.btn.primary:hover {
    background-color: var(--secondary-color);
}

.btn.secondary {
    background-color: #e9ecef;
    color: var(--dark-color);
}

.btn.secondary:hover {
    background-color: #dee2e6;
}

.btn.tertiary {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn.tertiary:hover {
    background-color: rgba(67, 97, 238, 0.1);
}

.btn.icon-btn {
    padding: 8px;
    background: transparent;
    color: #666;
}

.btn.icon-btn:hover {
    color: var(--primary-color);
    background: rgba(67, 97, 238, 0.1);
}

.result-card {
    background: #f8f9fa;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
}

.result-card h3 {
    margin-bottom: 15px;
    color: #555;
}

.result-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
    min-height: 60px;
}

.formula-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 10px 15px;
    border-radius: var(--border-radius);
    border: 1px solid #eee;
}

.visualization {
    background: #f8f9fa;
    border-radius: var(--border-radius);
    padding: 20px;
}

.visualization h3 {
    margin-bottom: 15px;
    color: #555;
}

.triangle-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

.triangle-labels {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.triangle-labels span {
    position: absolute;
    font-weight: bold;
    color: var(--primary-color);
}

#label-a {
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
}

#label-b {
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
}

#label-c {
    top: 20px;
    left: 20px;
}

.history-section {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--box-shadow);
    margin-bottom: 30px;
}

.history-section h3 {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 15px;
    border: 1px solid #eee;
    border-radius: var(--border-radius);
}

.history-item {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item .formula {
    font-family: monospace;
    color: #666;
}

.history-item .result {
    font-weight: 600;
    color: var(--primary-color);
}

.history-item .timestamp {
    font-size: 0.8rem;
    color: #999;
}

.info-section {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--box-shadow);
}

.info-card h3 {
    margin-bottom: 15px;
    color: #555;
}

.info-card p {
    margin-bottom: 15px;
}

.formula-box {
    background: #f8f9fa;
    padding: 15px;
    border-radius: var(--border-radius);
    text-align: center;
    font-family: monospace;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
    border: 1px dashed #ccc;
}

.hidden {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .calculator-container {
        flex-direction: column;
    }
    
    .input-section, .result-section {
        width: 100%;
    }
}