/* Diagnosis Diet Modern Theme */
:root {
    --primary-blue: #708abf;
    --secondary-blue: #4a6ba3;
    --accent-gold: #b8a082;
    --text-dark: #2c3e50;
    --text-muted: #6c757d;
    --background-light: #f8f9fa;
    --card-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --border-radius: 0.5rem;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-dark);
    background-color: var(--background-light);
}

/* Header Styling */
.navbar {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem 0;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 600;
    color: white !important;
}

.nav-link {
    color: rgba(255,255,255,0.9) !important;
    font-weight: 500;
    margin: 0 0.5rem;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: white !important;
}

/* Logo styling */
.logo-circle {
    width: 40px;
    height: 40px;
    background-color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    font-weight: bold;
    color: var(--primary-blue);
    font-size: 1.2rem;
}

/* Main Content */
.main-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    margin-top: 2rem;
    margin-bottom: 2rem;
    overflow: hidden;
}

.page-header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 0.5rem;
}

.page-header p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 0;
}

/* Form Section Cards */
.form-section {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--card-shadow);
    border-left: 4px solid var(--primary-blue);
}

.form-section h4 {
    color: var(--primary-blue);
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--background-light);
}

/* Form Controls */
.form-label {
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.form-control, .form-select {
    border: 2px solid #e9ecef;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 0.2rem rgba(112, 138, 191, 0.25);
}

.input-width {
    width: 200px;
}

/* Form Row Styling */
.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(112, 138, 191, 0.1);
}

.form-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* Output Section */
.output-section {
    background: var(--background-light);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
}

.output-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary-blue);
}

.output-title {
    color: var(--primary-blue);
    font-weight: 600;
    font-size: 1.5rem;
    margin: 0;
    flex-grow: 1;
}

#copyButton {
    background: var(--accent-gold);
    border: none;
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    margin-right: 1rem;
    font-weight: 500;
    font-size: 0.95rem;
    min-width: 120px;
    box-shadow: 0 2px 4px rgba(184, 160, 130, 0.2);
}

#copyButton:hover {
    background: #a08f74;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(184, 160, 130, 0.3);
}

#copyButton:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(184, 160, 130, 0.2);
}

#copyButton svg {
    flex-shrink: 0;
}

#copyButton .d-none.d-sm-inline {
    white-space: nowrap;
}

.alert-box {
    padding: 0.5rem 1rem;
    height: auto;
    width: auto;
    margin: 0;
    border-radius: 0.375rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.alert-box.show {
    opacity: 1;
}

#output-text-container {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    min-height: 200px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

#output-text p {
    margin-bottom: 0.5rem;
    padding: 0.75rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-dark);
    border-left: 4px solid var(--primary-blue);
    background: rgba(112, 138, 191, 0.05);
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    border: 1px solid rgba(112, 138, 191, 0.1);
}

#output-text p:hover {
    background: rgba(112, 138, 191, 0.08);
    border-left-color: var(--accent-gold);
}

#output-text p:last-child {
    margin-bottom: 0;
}

/* Empty state styling */
#output-text p em {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    display: block;
    padding: 1rem;
}

/* Patient Info Section */
.patient-info {
    background: linear-gradient(135deg, rgba(112, 138, 191, 0.1) 0%, rgba(184, 160, 130, 0.1) 100%);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-primary {
    color: var(--primary-blue) !important;
}

.bg-primary {
    background-color: var(--primary-blue) !important;
}

.btn-primary {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
}

.btn-primary:hover {
    background-color: var(--secondary-blue);
    border-color: var(--secondary-blue);
}

.btn-accent {
    background-color: var(--accent-gold);
    border-color: var(--accent-gold);
    color: white;
}

.btn-accent:hover {
    background-color: #a08f74;
    border-color: #a08f74;
    color: white;
}

/* Back to Top Button */
.back-to-top {
    background: var(--accent-gold);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 2rem;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.back-to-top:hover {
    background: #a08f74;
    color: white;
}

/* Footer */
.page-footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    border-top: 1px solid #e9ecef;
    margin-top: 3rem;
}

/* Mobile Navigation Improvements */
.navbar-toggler {
    border: none;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0.375rem;
    min-width: 44px;
    min-height: 44px;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

.navbar-toggler:hover {
    background: rgba(255, 255, 255, 0.15);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Touch device optimizations */
    .form-control, .form-select {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .btn, button {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* Prevent text zoom on form inputs for mobile Safari */
input[type="date"],
input[type="number"],
select {
    font-size: 16px;
}

/* Mobile-First Responsive Design */
@media (max-width: 576px) {
    /* Navigation adjustments for small screens */
    .navbar {
        padding: 0.5rem 0;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .logo-circle {
        width: 35px;
        height: 35px;
        font-size: 1.1rem;
        margin-right: 0.5rem;
    }
    
    .nav-link {
        padding: 0.75rem 0;
        margin: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .nav-link:last-child {
        border-bottom: none;
    }
    
    /* Main container mobile optimizations */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .main-container {
        margin-top: 1rem;
        margin-bottom: 1rem;
        border-radius: 0.75rem;
    }
    
    /* Page header mobile adjustments */
    .page-header {
        padding: 1.5rem 1rem;
    }
    
    .page-header h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }
    
    .page-header p {
        font-size: 1rem;
    }
    
    /* Content padding adjustments */
    .p-4 {
        padding: 1rem !important;
    }
    
    /* Alert mobile styling */
    .alert {
        font-size: 0.9rem;
        padding: 0.75rem;
    }
    
    /* Form sections mobile optimization */
    .form-section, .patient-info, .output-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .form-section h4 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    
    /* Form rows - stack vertically on mobile */
    .form-row {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 1rem;
        padding: 0.75rem 0;
    }
    
    .form-label {
        margin-bottom: 0.5rem;
        font-size: 0.95rem;
    }
    
    .input-width {
        width: 100%;
        margin-top: 0;
    }
    
    .form-control, .form-select {
        padding: 0.75rem;
        font-size: 1rem;
        border-radius: 0.5rem;
    }
    
    /* Output section mobile optimization */
    .output-header {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }
    
    .output-title {
        font-size: 1.25rem;
        margin-bottom: 1rem;
        text-align: center;
    }
    
    #copyButton {
        margin: 0;
        align-self: center;
        width: auto;
        padding: 1rem 1.5rem;
        border-radius: 2rem;
        margin-bottom: 1rem;
        min-width: 140px;
        font-size: 1rem;
        gap: 0.75rem;
    }
    
    #copyButton svg {
        width: 18px;
        height: 18px;
    }
    
    .alert-box {
        align-self: center;
        text-align: center;
    }
    
    #output-text-container {
        padding: 1rem;
        min-height: 150px;
    }
    
    #output-text {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    #output-text p {
        margin-bottom: 0.5rem;
        padding: 0.625rem;
        font-size: 0.9rem;
    }
    
    #output-text p:hover {
        background: rgba(112, 138, 191, 0.08);
    }
    
    /* Sticky positioning for mobile output */
    .output-section {
        position: sticky;
        top: 1rem;
        z-index: 10;
    }
    
    /* Back to top button mobile */
    .back-to-top {
        padding: 1rem 2rem;
        font-size: 1rem;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }
    
    /* Footer mobile */
    .page-footer {
        padding: 1.5rem 0;
        font-size: 0.9rem;
    }
    
    /* Mobile-specific improvements */
    .container {
        max-width: 100%;
    }
    
    /* Improve scroll behavior on mobile */
    html {
        scroll-behavior: smooth;
    }
    
    /* Better focus indicators for mobile */
    .form-control:focus,
    .form-select:focus,
    .btn:focus {
        outline: 2px solid var(--primary-blue);
        outline-offset: 2px;
    }
}

/* Tablet responsive design */
@media (min-width: 577px) and (max-width: 768px) {
    .form-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .input-width {
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .output-header {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
    
    #copyButton {
        margin: 0.5rem 0;
    }
    
    .page-header h1 {
        font-size: 2rem;
    }
}

/* Large mobile devices */
@media (min-width: 577px) and (max-width: 767px) {
    .form-row {
        flex-direction: row;
        align-items: center;
    }
    
    .input-width {
        width: 250px;
        margin-top: 0;
    }
    
    .form-label {
        flex: 1;
        margin-bottom: 0;
    }
}