/* Real Gas Law Calculator Styles */

* {
    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;
    color: #333;
    line-height: 1.6;
}

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

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

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

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.calculator-container {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
}

.parameters-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
}

.input-section, .results-section, .info-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.compact-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
    width: 100%;
    box-sizing: border-box;
}

.compact-list {
    margin: 0;
    padding-left: 15px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.compact-list li {
    margin-bottom: 4px;
}

.usage-info {
    background: #f7fafc;
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.usage-info h4 {
    margin: 0 0 8px 0;
    color: #2d3748;
    font-size: 1rem;
}

.usage-info p {
    margin: 0;
    font-size: 0.9rem;
    color: #4a5568;
}

.info-card h4 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: #2d3748;
}

.input-section h2, .results-section h2 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

.input-group {
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
    min-width: 0; /* Prevents flexbox overflow */
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #2d3748;
}

.input-with-unit {
    display: flex;
    gap: 10px;
    align-items: center;
}

.input-with-unit input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

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

.input-with-unit select {
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 16px;
    min-width: 80px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.input-with-unit select:focus {
    outline: none;
    border-color: #667eea;
}

.unit {
    padding: 12px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-weight: 500;
    color: #4a5568;
    min-width: 80px;
    text-align: center;
}

.solve-for-section {
    margin: 25px 0;
    padding: 20px;
    background: #f7fafc;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.solve-for-section h3 {
    margin-bottom: 15px;
    color: #2d3748;
}

.radio-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.radio-group input[type="radio"] {
    margin-right: 8px;
}

.radio-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 5px;
    transition: background-color 0.2s ease;
}

.radio-group label:hover {
    background-color: #e2e8f0;
}

.button-group {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.btn-primary, .btn-secondary {
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

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

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

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
    transform: translateY(-1px);
}

.result-box {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-box.has-result {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border-color: #38a169;
    font-size: 1.1rem;
    font-weight: 600;
}

.result-box.error {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
    border-color: #e53e3e;
}

.gas-constant-info, .equation-display {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.gas-constant-info h3, .equation-display h3 {
    color: #2d3748;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.gas-constant-info ul {
    list-style: none;
    padding-left: 0;
}

.gas-constant-info li {
    padding: 5px 0;
    border-bottom: 1px solid #e2e8f0;
    font-family: 'Courier New', monospace;
}

.gas-constant-info li:last-child {
    border-bottom: none;
}

.equation {
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    color: #667eea;
    margin: 15px 0;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 2px solid #667eea;
}

.info-section {
    display: block;
}

.info-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.info-card h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.info-card ul {
    list-style-type: none;
    padding-left: 0;
}

.info-card li {
    padding: 8px 0;
    border-left: 3px solid #667eea;
    padding-left: 15px;
    margin-bottom: 8px;
    background: #f7fafc;
    border-radius: 0 5px 5px 0;
}

.info-card strong {
    color: #667eea;
}

/* Responsive Design */
@media (max-width: 768px) {
    .calculator-container {
        max-width: 100%;
        padding: 0 5px;
    }
    
    .parameters-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .compact-info-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .radio-group {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .input-with-unit {
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
    }
    
    .input-with-unit select,
    .unit {
        min-width: auto;
        max-width: none;
        width: 100%;
    }
    
    .input-with-unit input {
        width: 100%;
    }
    
    .input-section, .results-section, .info-section {
        padding: 15px;
    }
}

/* Animation for result display */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-box.animated {
    animation: fadeInUp 0.5s ease-out;
}

/* Focus indicators for accessibility */
input:focus,
select:focus,
button:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Loading state */
.btn-primary.loading {
    position: relative;
    color: transparent;
}

.btn-primary.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}