/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #ff6b6b;
    --secondary-color: #4ecdc4;
    --accent-color: #ffe66d;
    --dark-bg: #2d3436;
    --light-bg: #f8f9fa;
    --card-bg: #ffffff;
    --text-dark: #2d3436;
    --text-light: #636e72;
    --border-color: #dfe6e9;
    --success-color: #00b894;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-bottom: 80px;
}

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

/* Header */
.header {
    background: var(--card-bg);
    padding: 25px 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 1.8rem;
    color: var(--primary-color);
    text-align: center;
    font-weight: 700;
    margin-bottom: 5px;
}

.header h1 i {
    margin-right: 10px;
}

.subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 400;
}

/* Main Container */
.main-container {
    padding: 30px 0;
}

/* Category Tabs */
.category-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

.tab-btn {
    background: var(--card-bg);
    border: 3px solid transparent;
    border-radius: 15px;
    padding: 20px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-family: 'Poppins', sans-serif;
    min-height: 100px;
}

.tab-btn i {
    font-size: 2rem;
    color: var(--text-light);
    transition: all 0.3s ease;
}

.tab-btn:active {
    transform: scale(0.97);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary-color), #ee5a6f);
    color: white;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
}

.tab-btn.active i {
    color: white;
}

/* Converter Section */
.converter-section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.converter-section.active {
    display: block;
}

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

.converter-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
}

.section-title {
    font-size: 1.4rem;
    color: var(--text-dark);
    margin-bottom: 25px;
    text-align: center;
    font-weight: 600;
}

.section-title i {
    color: var(--primary-color);
    margin-right: 8px;
}

/* Conversion Group */
.conversion-group {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 12px;
}

.value-input {
    width: 100%;
    padding: 18px;
    font-size: 1.3rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--light-bg);
    color: var(--text-dark);
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
}

.value-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.1);
}

.value-input.result {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-color: var(--success-color);
    font-weight: 600;
    color: #2e7d32;
}

.unit-select {
    width: 100%;
    padding: 18px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: white;
    color: var(--text-dark);
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.unit-select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 4px rgba(78, 205, 196, 0.1);
}

/* Swap Button */
.swap-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.swap-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary-color), #45b7af);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swap-btn:active {
    transform: rotate(180deg) scale(0.9);
}

.swap-btn:hover {
    box-shadow: var(--shadow-lg);
}

/* Quick Reference */
.quick-reference {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #fff9e6, #fff3cd);
    border-radius: 12px;
    border-left: 4px solid var(--accent-color);
}

.quick-reference h3 {
    font-size: 1rem;
    color: var(--text-dark);
    margin-bottom: 12px;
    font-weight: 600;
}

.quick-reference ul {
    list-style: none;
}

.quick-reference li {
    padding: 8px 0;
    color: var(--text-dark);
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.quick-reference li:last-child {
    border-bottom: none;
}

/* Action Buttons */
.action-buttons {
    margin-top: 25px;
    display: flex;
    justify-content: center;
}

.clear-btn {
    padding: 18px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 15px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: white;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    display: flex;
    align-items: center;
    gap: 10px;
}

.clear-btn:active {
    transform: scale(0.95);
}

.clear-btn:hover {
    box-shadow: var(--shadow-lg);
}

/* Footer */
.footer {
    background: var(--card-bg);
    padding: 20px 0;
    text-align: center;
    position: fixed;
    bottom: 0;
    width: 100%;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.1);
}

.footer p {
    color: var(--text-light);
    font-size: 0.85rem;
}

.footer i {
    color: var(--primary-color);
    margin-right: 5px;
}

/* Responsive Design */
@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .converter-card {
        padding: 20px;
    }

    .input-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .value-input,
    .unit-select {
        padding: 16px;
        font-size: 1.1rem;
    }

    .tab-btn {
        padding: 15px;
        min-height: 90px;
        font-size: 0.9rem;
    }

    .tab-btn i {
        font-size: 1.6rem;
    }
}

/* Touch Improvements */
@media (hover: none) and (pointer: coarse) {
    .tab-btn,
    .swap-btn,
    .clear-btn {
        touch-action: manipulation;
    }

    button {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
    /* Keep light theme for better visibility in kitchen */
}

/* Landscape Orientation */
@media (max-height: 600px) and (orientation: landscape) {
    .header {
        padding: 15px 0;
    }

    .main-container {
        padding: 20px 0;
    }

    .converter-card {
        padding: 20px;
    }

    body {
        padding-bottom: 60px;
    }
}
