* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: cover;
    color: #d4b896;
    min-height: 100vh;
    padding: clamp(16px, 3vw, 32px);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(42, 42, 42, 0.95);
    border-radius: 16px;
    padding: clamp(24px, 5vw, 48px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

/* Page header with title and share button */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: clamp(32px, 6vw, 56px);
    padding-bottom: clamp(16px, 3vw, 24px);
    border-bottom: 2px solid rgba(139, 115, 85, 0.3);
    flex-wrap: wrap;
    gap: 20px;
}

h1 {
    color: #f4e4c1;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    letter-spacing: 1px;
    margin: 0;
    flex: 1;
    text-align: left;
    font-weight: 700;
}

/* Share button styling */
.share-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: 2px solid #555;
    border-radius: 10px;
    background: linear-gradient(145deg, #3a3a3a, #2a2a2a);
    color: #d4b896;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    min-height: 48px;
    white-space: nowrap;
}

.share-btn:hover {
    border-color: #8b7355;
    background: linear-gradient(145deg, #4a3a2a, #3a2a1a);
    color: #f4e4c1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.share-icon {
    font-size: 18px;
}

.share-text {
    font-size: 16px;
}

h2 {
    color: #e6d7bb;
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    margin-bottom: clamp(16px, 3vw, 24px);
    border-bottom: 2px solid #8b7355;
    padding-bottom: 10px;
    font-weight: 600;
}

h3 {
    color: #e6d7bb;
    font-size: clamp(1.1rem, 2.5vw, 1.3rem);
    margin-bottom: 15px;
    font-weight: 600;
}

h4 {
    color: #d4b896;
    font-size: clamp(1rem, 2vw, 1.1rem);
    margin-bottom: 10px;
    font-weight: 600;
}

/* Mode selection */
.mode-selection {
    margin-bottom: clamp(32px, 6vw, 48px);
    text-align: center;
}

.mode-header {
    color: #e6d7bb;
    font-size: clamp(1.2rem, 2.5vw, 1.4rem);
    margin-bottom: clamp(16px, 3vw, 24px);
    font-weight: 600;
    border-bottom: none;
    padding-bottom: 0;
}

.mode-buttons {
    display: inline-flex;
    background: #2a2a2a;
    border: 2px solid #555;
    border-radius: 12px;
    padding: 6px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
}

.mode-btn {
    padding: clamp(12px, 2vw, 16px) clamp(24px, 4vw, 32px);
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #a0a0a0;
    font-size: clamp(14px, 2vw, 16px);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    position: relative;
    z-index: 2;
    min-width: clamp(140px, 20vw, 160px);
    text-align: center;
}

.mode-btn:hover {
    color: #d4b896;
}

.mode-btn.active {
    background: linear-gradient(145deg, #8b7355, #6a5a42);
    color: #f4e4c1;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.4),
        0 0 15px rgba(139, 115, 85, 0.3);
    transform: translateY(-1px);
}

/* Mode button content styling */
.mode-icon {
    display: block;
    font-size: clamp(18px, 3vw, 20px);
    margin-bottom: 4px;
    line-height: 1;
}

.mode-text {
    display: block;
    font-size: clamp(12px, 2vw, 14px);
    line-height: 1.2;
}

/* Input section */
.input-section {
    display: flex;
    flex-direction: column;
    gap: clamp(20px, 4vw, 32px);
    margin: 0 auto clamp(32px, 6vw, 48px);
    max-width: 600px;
    padding: clamp(20px, 4vw, 32px);
    background: rgba(30, 30, 30, 0.5);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group.max-only,
.input-group.target-only {
    max-width: 100%;
}

/* Refinery options styling */
.refinery-options {
    margin-top: 0;
    padding: clamp(16px, 3vw, 20px);
    background: rgba(20, 20, 20, 0.6);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

label {
    margin-bottom: 8px;
    font-weight: 600;
    color: #e6d7bb;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

input[type="text"], input[type="number"] {
    padding: clamp(14px, 3vw, 18px) clamp(16px, 3vw, 20px);
    border: 2px solid #555;
    border-radius: 12px;
    background: linear-gradient(145deg, #2a2a2a, #333);
    color: #f4e4c1;
    font-size: clamp(16px, 3vw, 18px);
    font-weight: 600;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    min-height: clamp(52px, 8vw, 56px);
    width: 100%;
}

input[type="text"]:focus, input[type="number"]:focus {
    outline: none;
    border-color: #8b7355;
    background: linear-gradient(145deg, #3a3a3a, #444);
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.3),
        0 0 15px rgba(139, 115, 85, 0.4),
        0 0 30px rgba(139, 115, 85, 0.1);
    transform: translateY(-1px);
}

input[type="text"]::placeholder, input[type="number"]::placeholder {
    color: #888;
    font-weight: normal;
    letter-spacing: normal;
}

input[type="text"]:valid, input[type="number"]:valid {
    border-color: #4a8b3a;
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.3),
        0 0 8px rgba(74, 139, 58, 0.2);
}

/* Remove number input spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Input animations */
.input-group {
    position: relative;
}

.input-group::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #8b7355, #f4e4c1, #8b7355);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.input-group:focus-within::after {
    width: 100%;
}

/* Animated typing effect */
input[type="text"].typing, input[type="number"].typing {
    animation: pulse 0.3s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Number formatting visual cues */
input[type="text"]:not(:placeholder-shown), input[type="number"]:not(:placeholder-shown) {
    background: linear-gradient(145deg, #1a3a1a, #2a4a2a);
    border-color: #4a8b3a;
}

/* Large number display enhancement */
input[type="text"][data-large], input[type="number"][data-large] {
    font-size: clamp(18px, 3.5vw, 22px);
    color: #f4e4c1;
    text-shadow: 0 0 8px rgba(244, 228, 193, 0.3);
}

/* Mode sections */
.max-mode-section, .target-mode-section {
    display: none;
    margin-bottom: clamp(32px, 6vw, 48px);
    text-align: center;
}

.max-mode-section.active, .target-mode-section.active {
    display: block;
}

.mode-description {
    font-size: clamp(1rem, 2.2vw, 1.1rem);
    color: #c4a373;
    margin: 0 auto clamp(24px, 4vw, 32px);
    padding: clamp(16px, 3vw, 20px);
    background: rgba(196, 163, 115, 0.1);
    border-radius: 12px;
    border-left: 4px solid #8b7355;
    font-style: italic;
    max-width: 600px;
    line-height: 1.6;
}

/* Recommendations section */
.recommendations-section {
    margin: 0 auto;
    max-width: 800px;
}

.recommendation-card {
    background: linear-gradient(145deg, #3a3a3a, #2a2a2a);
    border: 2px solid #555;
    border-radius: 16px;
    padding: clamp(20px, 4vw, 32px);
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}



.efficiency-hint {
    color: #8b7355;
    cursor: pointer;
    font-size: clamp(0.8rem, 1.6vw, 0.9rem);
    margin-left: 5px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.efficiency-hint:hover {
    color: #f4e4c1;
    transform: scale(1.1);
}

.efficiency-explanation {
    margin-top: clamp(16px, 3vw, 20px);
    padding: clamp(16px, 3vw, 20px);
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border-radius: 12px;
    border: 1px solid #555;
    border-left: 4px solid #8b7355;
}

.explanation-content h4 {
    color: #f4e4c1;
    margin-bottom: clamp(8px, 2vw, 12px);
    font-size: clamp(1rem, 2.2vw, 1.1rem);
}

.explanation-content p {
    color: #d4b896;
    margin-bottom: clamp(6px, 1.5vw, 8px);
    line-height: 1.5;
    font-size: clamp(0.85rem, 1.8vw, 0.9rem);
}

.explanation-content p:last-child {
    margin-bottom: 0;
}


.toggle-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    color: #d4b896;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.toggle-label input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
    accent-color: #8b7355;
}

.toggle-text {
    display: flex;
    align-items: center;
    font-weight: bold;
    margin-bottom: 4px;
}

.toggle-hint {
    font-size: clamp(0.8rem, 1.8vw, 0.85rem);
    color: #a0a0a0;
    font-style: italic;
    text-align: center;
}

.toggle-label:hover .toggle-text {
    color: #f4e4c1;
}

.toggle-label:hover .toggle-hint {
    color: #c0c0c0;
}

/* Responsive design improvements */
@media (min-width: 768px) {
    .page-header {
        flex-wrap: nowrap;
    }
    
    .input-section {
        max-width: 500px;
    }
    
    .details-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 48px 64px;
    }
    
    .input-section {
        padding: 40px;
        max-width: 500px;
    }
    
    .recommendation-card {
        padding: 40px;
    }
    
    .raw-data-table {
        padding: 32px;
    }
    
    .refinery-table {
        min-width: auto;
    }
    
    .details-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .mode-btn {
        padding: 12px 16px;
        min-width: 120px;
    }
    
    .mode-icon {
        font-size: 18px;
        margin-bottom: 3px;
    }
    
    .mode-text {
        font-size: 12px;
    }
    
    .mode-buttons {
        padding: 3px;
    }
    
    .share-btn {
        padding: 10px 16px;
        min-height: 44px;
    }
    
    .details-grid {
        grid-template-columns: 1fr;
    }
}

/* Main Layout Structure */
.main-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.control-panel {
    background: rgba(20, 20, 20, 0.6);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    height: fit-content;
    position: sticky;
    top: 2rem;
}

.results-panel {
    min-height: 400px;
}

/* Enhanced Formula Display */
.formula-display {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.formula-inputs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.formula-outputs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.formula-item, .formula-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.formula-result {
    background: rgba(212, 175, 55, 0.1);
    border-radius: 6px;
    padding: 0.5rem;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.formula-icon {
    font-size: 1.5rem;
    width: 24px;
    height: 24px;
    vertical-align: middle;
    margin: 0 4px;
}

.formula-value {
    font-weight: bold;
    font-size: 1.1rem;
    color: #d4af37;
}

.formula-label {
    font-size: 0.9rem;
    color: #ccc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Refinery Breakdown */
.refinery-breakdown {
    text-align: center;
}

.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.breakdown-item {
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.breakdown-header {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.breakdown-summary {
    font-size: 0.85rem;
    color: #d4af37;
    font-weight: 500;
}

.breakdown-line {
    margin: 0.2rem 0;
    line-height: 1.3;
}

.refinery-name {
    font-weight: bold;
    font-size: 1.1rem;
    color: #d4af37;
}

/* Enhanced Efficiency Display */

.efficiency-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.efficiency-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff4444, #ffaa00, #44ff44);
    border-radius: 4px;
    transition: width 0.8s ease-out;
    width: 0%;
}

.efficiency-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.efficiency-label {
    font-size: 0.9rem;
    color: #ccc;
}

.efficiency-value {
    font-weight: bold;
    color: #d4af37;
}

.efficiency-rating {
    font-size: 0.9rem;
    font-weight: bold;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    min-width: 60px;
    text-align: center;
}

.efficiency-rating.poor {
    background: rgba(255, 68, 68, 0.2);
    color: #ffffff;
    border: 1px solid #ff4444;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.efficiency-rating.fair {
    background: rgba(255, 152, 0, 0.2);
    color: #ffffff;
    border: 1px solid #ff9800;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.efficiency-rating.good {
    background: rgba(76, 175, 80, 0.2);
    color: #ffffff;
    border: 1px solid #4caf50;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.efficiency-rating.excellent {
    background: rgba(46, 125, 50, 0.2);
    color: #ffffff;
    border: 1px solid #2e7d32;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* Refinery Comparison */
.refinery-comparison {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.refinery-specs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1rem;
}

.refinery-specs-header:hover {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 0.5rem;
    margin: 0 -0.5rem 1rem -0.5rem;
}

.specs-title {
    color: #d4af37;
    font-size: 1rem;
    margin: 0;
    text-align: left;
}

.specs-toggle-icon {
    color: #8b7355;
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.specs-toggle-icon.collapsed {
    transform: rotate(-90deg);
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.comparison-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1rem;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.comparison-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.refinery-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.refinery-icon {
    font-size: 1.2rem;
}

.refinery-label {
    font-size: 0.9rem;
    color: #d4af37;
    font-weight: 600;
}

.refinery-specs {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.spec-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

.spec-label {
    color: #bbb;
    font-weight: 500;
}

.spec-value {
    color: #f4e4c1;
    font-weight: 600;
}

.spec-value.highlight {
    color: #d4af37;
    font-weight: bold;
}

.efficiency-meter {
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
}

.meter-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s ease-out;
    position: relative;
}

.meter-fill.small-fill {
    background: linear-gradient(90deg, #ff6b6b, #ff8a80) !important;
}

.meter-fill.medium-fill {
    background: linear-gradient(90deg, #ffa726, #ffb74d) !important;
}

.meter-fill.large-fill {
    background: linear-gradient(90deg, #4caf50, #66bb6a) !important;
}

.meter-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.7rem;
    font-weight: bold;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    text-align: center;
}

/* No Calculation State */
.no-calculation {
    padding: 3rem 2rem;
    font-size: 1.1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    background: rgba(20, 20, 20, 0.4);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: 1rem 0;
}


.no-calc-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #d4af37;
    text-align: center;
}

.no-calc-text {
    font-size: 1rem;
    color: #aaa;
    text-align: center;
    line-height: 1.5;
}

/* Animations */
.formula-display.animate {
    animation: slideInFromBottom 0.5s ease-out;
}

@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.formula-value.counting {
    animation: countUp 0.8s ease-out;
}

@keyframes countUp {
    from {
        transform: scale(0.8);
        opacity: 0.6;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Compact Header Override */
.page-header {
    margin-bottom: 1.5rem;
    padding-bottom: 0;
    border-bottom: none;
    justify-content: center;
}

h1 {
    font-size: 1.4rem;
    margin: 0;
    text-align: center;
    color: #d4af37;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Share Button Updates */
.share-section {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0 1rem;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #2a4a1a, #1a3a0a);
    border: 1px solid #4a8b3a;
    border-radius: 6px;
    color: #d4b896;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.share-btn:hover {
    background: linear-gradient(135deg, #3a5a2a, #2a4a1a);
    border-color: #5a9b4a;
    transform: translateY(-1px);
}

.share-icon {
    font-size: 0.9rem;
}

.share-text {
    font-size: 0.85rem;
}

/* Mobile responsive layout updates */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .control-panel {
        position: static;
        padding: 1.25rem;
    }
    
    .mode-buttons {
        justify-content: center;
    }
    
    .toggle-label {
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .main-layout {
        gap: 1rem;
    }
    
    .control-panel {
        padding: 1rem;
    }
    
    .mode-btn {
        padding: 0.6rem 0.8rem;
    }
    
    .comparison-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    
    .formula-inputs {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .formula-outputs {
        grid-template-columns: 1fr;
    }
    
    .no-calculation {
        padding: 2rem 1.5rem;
    }
    
    .no-calc-text {
        font-size: 0.9rem;
    }
}

