/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: #334155;
    line-height: 1.6;
    min-height: 100vh;
}

.app-container {
    min-height: 100vh;
    display: flex;
}

/* Sidebar Header styles */
.header {
    background: linear-gradient(180deg, #dc2626 0%, #b91c1c 50%, #991b1b 100%);
    width: 350px;
    padding: 60px 30px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 4px 0 20px rgba(220, 38, 38, 0.15);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

/* Add a subtle pattern overlay */
.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

.header-logo {
    width: 140px;
    height: 140px;
    border-radius: 28px;
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.15),
        0 8px 16px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    padding: 12px;
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
    margin-bottom: 30px;
}

.header-logo:hover {
    transform: translateY(-3px);
}

.logo-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 20px;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    z-index: 1;
}

.header-title {
    font-size: 28px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 12px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.header-subtitle {
    font-size: 18px;
    color: #fecaca;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    letter-spacing: 1px;
}

.header-credit {
    font-size: 14px;
    color: #fed7d7;
    font-style: italic;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Main content area */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 600px; /* Fixed width to prevent resizing */
    max-width: 600px;
    min-width: 600px; /* Ensure consistent width */
    margin: 0 auto;
    padding: 20px;
}

/* Tab Navigation */
.tab-navigation {
    background-color: #ffffff;
    display: flex;
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.tab-button {
    flex: 1;
    background: none;
    border: none;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #64748b;
    font-weight: 600;
    font-size: 16px;
}

.tab-button i {
    width: 20px;
    height: 20px;
}

.tab-button:hover {
    background-color: #f1f5f9;
    color: #475569;
}

.tab-button.active {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(239, 68, 68, 0.3);
}

.tab-button.active:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

/* Main content */
.main-content {
    flex: 1;
    width: 100%; /* Ensure full width usage */
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
    width: 100%; /* Ensure full width */
}

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

/* Card styles */
.card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    margin: 20px 0;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    width: 100%; /* Ensure consistent width */
    box-sizing: border-box; /* Include padding in width calculation */
}

.card-title {
    font-size: 20px;
    font-weight: bold;
    color: #1e293b;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.card-header i {
    width: 24px;
    height: 24px;
    color: #dc2626;
}

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

.input-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
}

.input {
    width: 100%;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 12px;
    padding: 16px;
    font-size: 16px;
    color: #1e293b;
    border: 2px solid #e2e8f0;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.input:focus {
    outline: none;
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.input.error {
    border-color: #f87171;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.1);
}

.input::placeholder {
    color: #94a3b8;
}

/* Error styles */
.error-container {
    display: flex;
    align-items: center;
    margin-top: 8px;
    gap: 8px;
}

.error-container i {
    width: 16px;
    height: 16px;
    color: #f87171;
}

.error-text {
    color: #f87171;
    font-size: 14px;
}

/* Sample volume buttons */
.sample-volume-container {
    display: flex;
    gap: 12px;
}

.sample-button {
    flex: 1;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-radius: 12px;
    padding: 16px;
    border: 2px solid #e2e8f0;
    color: #475569;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sample-button:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    border-color: #cbd5e1;
}

.sample-button.active {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-color: #dc2626;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
}

/* Action buttons */
.button-container {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.calculate-button {
    flex: 2;
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    border-radius: 12px;
    padding: 16px;
    border: none;
    color: #ffffff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.calculate-button:hover {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.calculate-button i {
    width: 20px;
    height: 20px;
}

.reset-button {
    flex: 1;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-radius: 12px;
    padding: 16px;
    border: 2px solid #e2e8f0;
    color: #475569;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-button:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

/* Results styles */
.result-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.result-label {
    font-size: 16px;
    color: #475569;
    font-weight: 500;
}

.result-value {
    font-size: 16px;
    font-weight: bold;
    color: #1e293b;
}

.result-value.warning {
    color: #f59e0b;
}

.result-value.success {
    color: #10b981;
}

.result-value.danger {
    color: #dc2626;
}

.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
    margin: 8px 0;
}

.recommendation-container {
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    border: 1px solid;
}

.recommendation-container.perfect {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #a7f3d0;
}

.recommendation-container.high {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
    border-color: #fdba74;
}

.recommendation-container.very-high {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    border-color: #fca5a5;
}

.recommendation-container.low {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #fde68a;
}

.recommendation-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 8px;
}

.recommendation-title.perfect {
    color: #047857;
}

.recommendation-title.high {
    color: #c2410c;
}

.recommendation-title.very-high {
    color: #b91c1c;
}

.recommendation-title.low {
    color: #b45309;
}

.recommendation-value {
    font-size: 24px;
    font-weight: bold;
    margin: 0;
}

.recommendation-value.perfect {
    color: #047857;
}

.recommendation-value.high {
    color: #c2410c;
}

.recommendation-value.very-high {
    color: #b91c1c;
}

.recommendation-value.low {
    color: #b45309;
}

.recommendation-exact {
    font-size: 18px;
    font-weight: 600;
    margin: 8px 0;
}

.recommendation-exact.low {
    color: #92400e;
}

.recommendation-note {
    font-size: 14px;
    margin-top: 8px;
}

.recommendation-note.perfect {
    color: #065f46;
}

.recommendation-note.high {
    color: #9a3412;
}

.recommendation-note.very-high {
    color: #991b1b;
}

.recommendation-note.low {
    color: #a16207;
}

/* Info section styles */
.info-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.info-item {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid #e2e8f0;
}

.info-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.info-header i {
    width: 24px;
    height: 24px;
    color: #dc2626;
}

.info-header h3 {
    font-size: 18px;
    font-weight: bold;
    color: #1e293b;
    margin: 0;
}

.info-item h3 {
    font-size: 18px;
    font-weight: bold;
    color: #1e293b;
    margin-bottom: 12px;
}

.info-item h4 {
    font-size: 16px;
    font-weight: bold;
    color: #1e293b;
    margin-bottom: 12px;
}

.info-item h5 {
    font-size: 14px;
    font-weight: bold;
    color: #1e293b;
    margin-bottom: 8px;
}

.info-item p {
    font-size: 16px;
    color: #475569;
    line-height: 1.6;
    margin-bottom: 12px;
}

.info-item p:last-child {
    margin-bottom: 0;
}

.level-container {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
    border: 1px solid #e2e8f0;
}

.level-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.level-row:last-child {
    margin-bottom: 0;
}

.level-label {
    font-size: 16px;
    color: #475569;
}

.level-value {
    font-size: 16px;
    font-weight: bold;
    color: #dc2626;
}

.level-value-optimal {
    font-size: 16px;
    font-weight: bold;
    color: #10b981;
}

.level-value-warning {
    font-size: 16px;
    font-weight: bold;
    color: #f59e0b;
}

.product-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.product-section {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #e2e8f0;
}

.dosage-info {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
    border: 1px solid #e2e8f0;
}

.dosage-info ul {
    list-style: none;
    padding: 0;
}

.dosage-info li {
    font-size: 14px;
    color: #475569;
    line-height: 1.5;
    margin-bottom: 4px;
    position: relative;
    padding-left: 16px;
}

.dosage-info li::before {
    content: '•';
    color: #dc2626;
    position: absolute;
    left: 0;
    font-weight: bold;
}

.credits-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.logo-container {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    border-radius: 50px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    border: 2px solid #fca5a5;
}

.logo-container i {
    width: 40px;
    height: 40px;
    color: #b91c1c;
}

.credits-text {
    font-size: 16px;
    color: #475569;
    text-align: center;
    line-height: 1.5;
}

.credits-highlight {
    color: #dc2626;
    font-weight: bold;
}

.company-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #e2e8f0;
}

.company-container i {
    width: 20px;
    height: 20px;
    color: #dc2626;
}

.company-text {
    font-size: 14px;
    color: #475569;
    text-align: center;
    line-height: 1.4;
    margin: 0;
}

.company-highlight {
    color: #dc2626;
    font-weight: bold;
    font-size: 16px;
}

/* Responsive design */
@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
    }
    
    .header {
        width: 100%;
        padding: 30px 20px;
        flex-direction: row;
        justify-content: center;
        gap: 30px;
        box-shadow: 0 4px 20px rgba(220, 38, 38, 0.15);
    }
    
    .header-logo {
        width: 120px;
        height: 120px;
        margin-bottom: 0;
    }
    
    .header-content {
        text-align: left;
        align-items: flex-start;
    }
    
    .content-area {
        max-width: none;
        min-width: auto;
        width: 100%;
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 24px 20px;
        gap: 20px;
        flex-direction: column;
        text-align: center;
    }
    
    .header-logo {
        width: 100px;
        height: 100px;
        border-radius: 20px;
        margin-bottom: 20px;
    }
    
    .header-content {
        text-align: center;
        align-items: center;
    }
    
    .header-title {
        font-size: 24px;
    }
    
    .header-subtitle {
        font-size: 16px;
    }
    
    .header-credit {
        font-size: 13px;
    }
    
    .content-area {
        padding: 16px;
        width: 100%;
        min-width: auto;
    }
    
    .card {
        padding: 20px;
    }
    
    .button-container {
        flex-direction: column;
    }
    
    .calculate-button,
    .reset-button {
        flex: none;
    }

    .tab-button span {
        display: none;
    }

    .tab-button {
        padding: 16px 12px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 20px 16px;
    }
    
    .header-logo {
        width: 80px;
        height: 80px;
        border-radius: 16px;
    }
    
    .header-title {
        font-size: 20px;
    }
    
    .header-subtitle {
        font-size: 14px;
    }
    
    .header-credit {
        font-size: 12px;
    }
    
    .content-area {
        padding: 12px;
    }
}

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

.card.show {
    animation: fadeIn 0.3s ease-out;
}

.tab-content {
    animation: fadeIn 0.3s ease-in-out;
}

/* PWA specific styles */
@media (display-mode: standalone) {
    .header {
        padding-top: 70px; /* Account for status bar */
    }
}
