* {
    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 50%, #1a1a1a 100%);
    min-height: 100vh;
    color: #ffffff;
    line-height: 1.6;
}

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

header {
    text-align: center;
    margin-bottom: 25px;
    color: #d4af37;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 8px;
}

.logo {
    height: 60px;
    width: auto;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.5));
}

header h1 {
    font-size: 2.8rem;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    background: linear-gradient(135deg, #ffd700 0%, #ffb347 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.unit-selector {
    background: linear-gradient(135deg, #2a2a2a 0%, #3d3d3d 100%);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #d4af37;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.1);
    margin-bottom: 15px;
    text-align: center;
}

.unit-selector h3 {
    color: #d4af37;
    margin-bottom: 12px;
    font-size: 1.2rem;
}

.unit-options {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 12px;
}

.unit-options:last-child {
    margin-bottom: 0;
}

.unit-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: 500;
    color: #e5e5e5;
    transition: color 0.3s ease;
}

.unit-option:hover {
    color: #d4af37;
}

.unit-option input[type="radio"] {
    margin: 0;
    cursor: pointer;
    accent-color: #d4af37;
}

.weight-input-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.weight-input-container input {
    flex: 1;
}

.oz-input {
    width: 80px;
    /* Inherits standardized styles from input[type] rules above */
}

.conversion-display {
    color: #718096;
    font-style: italic;
    margin-top: 5px;
}

/* Dynamic Ingredients Styling */
.ingredients-section {
    margin: 20px 0;
}

.ingredients-section h3 {
    color: #d4af37;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.ingredient-item {
    margin-bottom: 10px;
    padding: 10px;
    background: linear-gradient(135deg, #2a2a2a 0%, #3d3d3d 100%);
    border-radius: 6px;
    border-left: 3px solid #d4af37;
}

.ingredient-controls-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ingredient-type {
    flex: 2;
    /* Inherits standardized styles from input[type] rules above */
}

/* Focus styles now handled by global input[type]:focus rules */

.ingredient-percentage {
    width: 80px;
    text-align: center;
    /* Inherits standardized styles from input[type] rules above */
}

.ingredient-amount {
    flex: 1;
    /* Inherits standardized styles from input[type] rules above */
}

.ingredient-oz {
    width: 80px;
    /* Inherits standardized styles from input[type] rules above */
}

.percentage-symbol {
    color: #d4af37;
    font-weight: 600;
}

.unit-label,
.oz-label {
    color: #d4af37;
    font-weight: 600;
    margin-left: 8px;
    white-space: nowrap;
}

.ingredient-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #d4af37;
}

.add-btn {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.remove-btn {
    background: #f56565;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.remove-btn:hover {
    background: #e53e3e;
    transform: scale(1.1);
}

.reset-btn {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
    background: linear-gradient(135deg, #3182ce 0%, #2c5aa0 100%);
}

.total-percentage {
    font-weight: 600;
    font-size: 16px;
}

.total-percentage .at-limit {
    color: #38a169;
}

.total-percentage .over-limit {
    color: #f56565;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ABV Section - Horizontal Layout */
.abv-section {
    margin: 20px 0 30px 0;
}

.abv-horizontal {
    max-width: none;
}

.abv-inputs-row {
    display: flex;
    align-items: end;
    gap: 20px;
    flex-wrap: wrap;
}

.abv-inputs-row .input-group {
    flex: 0 0 auto;
    min-width: 180px;
}

.abv-inputs-row .result {
    flex: 1;
    margin-top: 0;
    min-width: 300px;
}

@media (max-width: 768px) {
    .abv-inputs-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .abv-inputs-row .input-group,
    .abv-inputs-row .result {
        min-width: auto;
        width: 100%;
    }
    
    .abv-inputs-row .result {
        margin-top: 20px;
    }
}

.calculator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 25px;
}

.calc-section {
    background: linear-gradient(135deg, #2a2a2a 0%, #3d3d3d 100%);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #d4af37;
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Unified Calculator Grid Layout */
.unified-calc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    min-height: 400px;
}

/* Unified Calculator Input and Results Sections */
.unified-inputs-section {
    background: linear-gradient(135deg, #2d2d2d 0%, #3a3a3a 100%);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #555;
}

.unified-results-section {
    background: linear-gradient(135deg, #1a3a1a 0%, #2d5a2d 100%);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #4a7c59;
}

.unified-section-header {
    color: #d4af37;
    font-size: 1.4rem;
    margin-bottom: 20px;
    border-bottom: 1px solid #d4af37;
    padding-bottom: 8px;
}

.unified-placeholder {
    color: #90ee90;
    margin-bottom: 15px;
}

/* Mobile responsive layout for unified calculator */
@media (max-width: 768px) {
    .unified-calc-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        min-height: auto;
    }
    
    .unified-inputs-section,
    .unified-results-section {
        padding: 20px;
    }
    
    .unified-section-header {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }
}

.calc-section:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(212, 175, 55, 0.2);
}

.calc-section h2 {
    color: #d4af37;
    margin-bottom: 15px;
    font-size: 1.5rem;
    border-bottom: 1px solid #d4af37;
    padding-bottom: 8px;
}

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

.input-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #ffffff;
}

/* Standardized input sizing for all input elements */
input[type="number"],
input[type="text"],
select {
    padding: 12px 16px;
    border: 1px solid #d4af37;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1.5;
    min-height: 48px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #1a1a1a;
    color: #ffffff;
    box-sizing: border-box;
}

.input-group input,
.input-group select {
    width: 100%;
}

/* Standardized focus styles for all inputs */
input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: #ffd700;
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}


.input-group small {
    color: #e5e5e5;
    font-size: 0.85rem;
    margin-top: 4px;
    display: block;
}

/* Button styles removed - calculations now happen in real-time */

.result {
    margin-top: 15px;
    padding: 0;
    border-radius: 6px;
    min-height: 20px;
}

.success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #38a169;
    box-shadow: 0 3px 10px rgba(72, 187, 120, 0.2);
}

.error {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
    padding: 12px 15px;
    border-radius: 6px;
    border: 1px solid #e53e3e;
    box-shadow: 0 3px 10px rgba(245, 101, 101, 0.2);
}

.warning {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
    padding: 12px 15px;
    border-radius: 6px;
    border: 1px solid #dd6b20;
    margin-top: 8px;
    box-shadow: 0 3px 10px rgba(237, 137, 54, 0.2);
}

.info {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    padding: 12px 15px;
    border-radius: 6px;
    border: 1px solid #3182ce;
    box-shadow: 0 3px 10px rgba(66, 153, 225, 0.2);
    opacity: 0.9;
    font-style: italic;
}

.result h3 {
    margin-bottom: 12px;
    font-size: 1.3rem;
}

.result h4 {
    margin: 12px 0 8px 0;
    font-size: 1.1rem;
}

.result p {
    margin-bottom: 6px;
    font-size: 1rem;
}

.result ul {
    margin-left: 18px;
    margin-top: 8px;
}

.result li {
    margin-bottom: 4px;
}

.reference-content {
    background: linear-gradient(135deg, #2a2a2a 0%, #3d3d3d 100%);
    padding: 15px;
    border-radius: 6px;
    border-left: 3px solid #d4af37;
}

.reference-content h3 {
    color: #d4af37;
    margin-bottom: 8px;
    margin-top: 15px;
    font-size: 1.1rem;
}

.reference-content h3:first-child {
    margin-top: 0;
}

.reference-content ul {
    margin-left: 18px;
    margin-bottom: 12px;
}

.reference-content li {
    margin-bottom: 4px;
    color: #e5e5e5;
}

.reference-content strong {
    color: #ffffff;
}

/* Collapsible sections */
.collapsible-section {
    margin-bottom: 12px;
    border-bottom: 1px solid #d4af37;
    padding-bottom: 8px;
}

.collapsible-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.collapsible-header {
    cursor: pointer;
    user-select: none;
    padding: 8px 0;
    margin: 0;
    font-size: 1.1rem;
    color: #e5e5e5;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.collapsible-header:hover {
    color: #d4af37;
}

.collapsible-header.expanded {
    color: #d4af37;
}

.toggle-icon {
    font-size: 0.9rem;
    transition: transform 0.3s ease;
    width: 14px;
    text-align: center;
    color: #d4af37;
}

.collapsible-content {
    display: none;
    padding-left: 20px;
    margin-top: 4px;
}

.collapsible-content ul {
    margin-left: 18px;
    margin-bottom: 8px;
}

.collapsible-content li {
    margin-bottom: 4px;
    color: #e5e5e5;
}

@media (max-width: 768px) {
    .container {
        padding: 12px;
    }
    
    .logo-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .logo {
        height: 50px;
    }
    
    header h1 {
        font-size: 2.3rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    .calculator-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .calc-section {
        padding: 15px;
    }
    
    .calc-section h2 {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .logo {
        height: 40px;
    }
    
    header h1 {
        font-size: 1.9rem;
    }
    
    .calc-section {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .input-group input,
    .input-group select,
    button {
        font-size: 14px;
        padding: 8px 12px;
    }
}

/* Animation for results appearing */
.result > div {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Improved input validation styles */
input:invalid {
    border-color: #f56565;
}

input:valid {
    border-color: #48bb78;
}

/* Focus states for better accessibility */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #d4af37;
    outline-offset: 1px;
}

/* Loading state for buttons */
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Remove number input spinners/steppers for all browsers */
input[type="number"] {
    -moz-appearance: textfield; /* Firefox */
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none; /* Chrome, Safari, Edge */
    margin: 0;
}

/* Enhanced hover effects */
.calc-section {
    position: relative;
    overflow: hidden;
}

.calc-section::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: linear-gradient(135deg, #d4af37, #ffd700);
    z-index: -1;
    opacity: 0;
    border-radius: 8px;
    transition: opacity 0.3s ease;
}

.calc-section:hover::before {
    opacity: 0.15;
}

/* Conversion Utility Styles */
.conversion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.conversion-item {
    padding: 12px 15px;
    border-radius: 8px;
    border: 2px solid #e8e8e8;
    background: #fafafa;
    text-align: center;
    transition: all 0.3s ease;
}

.conversion-item.conversion-source {
    border-color: #d4af37;
    background: linear-gradient(135deg, #ffd700, #d4af37);
    color: #333;
    font-weight: bold;
}

.conversion-item.conversion-result {
    border-color: #4CAF50;
    background: linear-gradient(135deg, #e8f5e8, #f1f8f1);
}

.conversion-label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
}

.conversion-item.conversion-source .conversion-label {
    color: #333;
    font-weight: bold;
}

.conversion-value {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
}

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

/* Mobile responsive adjustments for conversions */
@media (max-width: 768px) {
    .conversion-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .conversion-item {
        padding: 10px;
    }
    
    .conversion-value {
        font-size: 1.1em;
    }
}

/* Buy Me A Coffee Support Section - Clean & Minimal */
.support-section-top {
    margin: 15px 0 20px 0;
    padding: 12px;
    text-align: center;
}

.support-content {
    margin: 0 auto;
}

.coffee-button {
    display: inline-block;
    transition: transform 0.2s ease, opacity 0.2s ease;
    border-radius: 8px;
    overflow: hidden;
    opacity: 0.85;
}

.coffee-button:hover {
    transform: translateY(-1px);
    opacity: 1;
}

.coffee-img {
    height: 45px;
    width: auto;
    border-radius: 6px;
    transition: transform 0.2s ease;
}

.coffee-button:hover .coffee-img {
    transform: scale(1.02);
}

/* Mobile responsive adjustments for Buy Me A Coffee section */
@media (max-width: 768px) {
    .support-section-top {
        margin: 10px 0 15px 0;
        padding: 8px;
    }
    
    .coffee-img {
        height: 40px;
    }
}