/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #EDEEF7 0%, #E4FBFF 100%);
    min-height: 100vh;
    position: relative;
}

/* Paper Texture Effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 50%, transparent 20%, rgba(255,255,255,0.3) 21%, rgba(255,255,255,0.3) 34%, transparent 35%, transparent),
        linear-gradient(0deg, rgba(255,255,255,0.1) 50%, transparent 50%);
    background-size: 30px 30px, 20px 20px;
    pointer-events: none;
    opacity: 0.3;
    z-index: -1;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(120, 104, 230, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.header__title {
    font-size: 2.5rem;
    color: #7868E6;
    margin-bottom: 10px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header__subtitle {
    font-size: 1.1rem;
    color: #666;
    font-weight: 400;
}

/* Navigation */
.navigation {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 15px;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid transparent;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 600;
    color: #7868E6;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(120, 104, 230, 0.2);
    border-color: #B8B5FF;
}

.nav-btn--active {
    background: linear-gradient(135deg, #7868E6, #B8B5FF);
    color: white;
    border-color: #7868E6;
}

.nav-btn__icon {
    font-size: 1.5rem;
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content--active {
    display: block;
}

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

/* Converter Card */
.converter-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.converter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #7868E6, #B8B5FF, #FFB4B4);
}

.converter-card__title {
    font-size: 1.8rem;
    color: #7868E6;
    margin-bottom: 25px;
    text-align: center;
    font-weight: 600;
}

/* Input Groups */
.input-group {
    margin-bottom: 20px;
}

.input-group__label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 0.95rem;
}

.input-group__input,
.input-group__select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #E4FBFF;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.input-group__input:focus,
.input-group__select:focus {
    outline: none;
    border-color: #7868E6;
    box-shadow: 0 0 0 3px rgba(120, 104, 230, 0.1);
    transform: translateY(-1px);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn--primary {
    background: linear-gradient(135deg, #7868E6, #B8B5FF);
    color: white;
    box-shadow: 0 4px 15px rgba(120, 104, 230, 0.3);
    width: 100%;
    margin: 20px 0;
}

.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(120, 104, 230, 0.4);
}

.btn--secondary {
    background: linear-gradient(135deg, #FFB4B4, #E4FBFF);
    color: #7868E6;
    width: 100%;
    margin-top: 15px;
}

.btn--secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 180, 180, 0.3);
}

.btn--outline {
    background: transparent;
    border: 2px solid #7868E6;
    color: #7868E6;
    margin: 10px 0;
}

.btn--outline:hover {
    background: #7868E6;
    color: white;
}

.btn--danger {
    background: linear-gradient(135deg, #FFB4B4, #ff8a8a);
    color: white;
    margin-top: 20px;
}

.btn--danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 180, 180, 0.4);
}

/* Results */
.results {
    margin-top: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #EDEEF7, #E4FBFF);
    border-radius: 15px;
    border-left: 4px solid #7868E6;
    display: none;
}

.results--visible {
    display: block;
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.results__title {
    color: #7868E6;
    margin-bottom: 15px;
    font-size: 1.3rem;
    font-weight: 600;
}

/* Size Grid */
.size-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.size-item {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.size-item:hover {
    border-color: #B8B5FF;
    transform: translateY(-2px);
}

.size-item__label {
    font-weight: 600;
    color: #7868E6;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.size-item__value {
    font-size: 1.1rem;
    color: #333;
    font-weight: 700;
}

/* Dosage Info */
.dosage-info {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.dosage-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #EDEEF7;
}

.dosage-detail:last-child {
    border-bottom: none;
}

.dosage-label {
    font-weight: 600;
    color: #555;
}

.dosage-value {
    font-weight: 700;
    color: #7868E6;
    font-size: 1.1rem;
}

/* Warning */
.warning {
    background: linear-gradient(135deg, #FFB4B4, #ffe6e6);
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
    border-left: 4px solid #ff6b6b;
}

.warning p {
    color: #d63031;
    font-size: 0.9rem;
    margin: 0;
}

/* Recipe Ingredients */
.recipe-ingredients {
    margin: 25px 0;
}

.recipe-ingredients h3 {
    color: #7868E6;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.ingredient-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.ingredient-name,
.ingredient-amount {
    padding: 10px;
    border: 2px solid #E4FBFF;
    border-radius: 8px;
    font-size: 0.9rem;
}

.ingredient-unit {
    padding: 10px;
    border: 2px solid #E4FBFF;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
}

.btn-remove-ingredient {
    background: #FFB4B4;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

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

/* Converted Recipe */
.converted-recipe {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 10px;
}

.converted-ingredient {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #EDEEF7;
}

.converted-ingredient:last-child {
    border-bottom: none;
}

.ingredient-info {
    font-weight: 600;
    color: #333;
}

.ingredient-converted {
    color: #7868E6;
    font-weight: 700;
}

/* Favorites */
.favorites-filter {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid #E4FBFF;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 600;
    color: #7868E6;
}

.filter-btn:hover,
.filter-btn--active {
    background: #7868E6;
    color: white;
    border-color: #7868E6;
}

.favorites-list {
    min-height: 200px;
}

.favorite-item {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-left: 4px solid #7868E6;
    position: relative;
    transition: all 0.3s ease;
}

.favorite-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.favorite-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.favorite-type {
    background: linear-gradient(135deg, #7868E6, #B8B5FF);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.favorite-date {
    color: #666;
    font-size: 0.8rem;
}

.favorite-content {
    color: #333;
    line-height: 1.5;
}

.favorite-actions {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 5px;
}

.btn-favorite-action {
    background: #FFB4B4;
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.btn-favorite-action:hover {
    background: #ff8a8a;
    transform: scale(1.1);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.empty-state p {
    margin-bottom: 10px;
}

/* Footer */
.footer {
    margin-top: 50px;
    padding: 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.footer__text {
    color: #7868E6;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header__title {
        font-size: 2rem;
    }
    
    .navigation {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .converter-card {
        padding: 20px;
    }
    
    .ingredient-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .size-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dosage-detail {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .favorites-filter {
        justify-content: center;
    }
    
    .favorite-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .favorite-actions {
        position: static;
        justify-content: flex-end;
        margin-top: 10px;
    }
}

@media (max-width: 480px) {
    .header__title {
        font-size: 1.5rem;
    }
    
    .navigation {
        grid-template-columns: 1fr;
    }
    
    .nav-btn {
        flex-direction: row;
        justify-content: center;
        padding: 15px;
    }
    
    .size-grid {
        grid-template-columns: 1fr;
    }
    
    .btn {
        padding: 15px 20px;
        font-size: 0.9rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .converter-card {
        border: 2px solid #333;
    }
    
    .btn--primary {
        background: #000;
        border: 2px solid #fff;
    }
    
    .input-group__input,
    .input-group__select {
        border: 2px solid #333;
    }
}

/* Focus styles for keyboard navigation */
.nav-btn:focus,
.btn:focus,
.input-group__input:focus,
.input-group__select:focus {
    outline: 3px solid #7868E6;
    outline-offset: 2px;
}
