@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
    --primary: #10b981;
    --primary-dark: #059669;
    --secondary: #0f172a;
    --accent: #38bdf8;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --glass: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Glassmorphism utility */
.glass {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
}

/* Notifications */
.notification {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    display: none;
    animation: slideIn 0.3s ease;
}

.notification.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
    display: block;
}

.notification.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    display: block;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Header & Nav */
header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 1rem 0;
    transition: all 0.3s ease;
}

header.scrolled {
    background: white;
    box-shadow: var(--shadow);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--primary);
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-primary {
    background: var(--primary);
    color: white !important;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    border: 2px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline:hover {
    background: var(--primary);
    color: white !important;
}

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    padding-top: 5rem;
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
}

.hero-content {
    flex: 1;
}

.hero h1 {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    color: var(--secondary);
}

.hero h1 span {
    color: var(--primary);
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    max-width: 600px;
}

.hero-container {
    display: flex;
    align-items: center;
    gap: 4rem;
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
}

/* Sections */
section {
    padding: 6rem 0;
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-header h2 {
    font-size: 2.5rem;
    color: var(--secondary);
    margin-bottom: 1rem;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
}

.feature-card {
    background: white;
    padding: 2.5rem;
    border-radius: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-10px);
}

.feature-icon {
    width: 60px;
    height: 60px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

/* Professionals Section */
.pro-card {
    background: white;
    padding: 2.5rem;
    border-radius: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
}

.pro-info h3 {
    margin-bottom: 0.5rem;
    color: var(--secondary);
}

/* Auth Pages Styles */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0fdf4 0%, #e0f2fe 100%);
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 450px;
    padding: 2.5rem;
    box-shadow: var(--shadow);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    outline: none;
    transition: border-color 0.3s;
}

.form-input:focus {
    border-color: var(--primary);
}

.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

/* Dashboard Base Styles */
.dashboard-grid {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    margin-top: 5rem;
    min-height: calc(100vh - 5rem);
}

.sidebar {
    padding: 2rem;
    border-right: 1px solid #e2e8f0;
}

.main-content {
    padding: 2rem;
}

.card {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.patient-list {
    list-style: none;
}

.patient-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    text-align: center;
    padding: 2rem;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0.5rem 0;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.chart-container {
    position: relative;
    height: 400px;
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.progress-entry {
    padding: 1rem;
    border-left: 3px solid var(--primary);
    margin-bottom: 1rem;
    background: white;
    border-radius: 0.5rem;
}

.progress-date {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

/* Mobile Menu Toggle Styles */
.menu-toggle {
    display: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
    z-index: 1001;
    position: relative;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background: var(--secondary);
    border-radius: 3px;
    transition: 0.3s;
}

/* Hamburger animation when active */
.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Footer */
footer {
    background: var(--secondary);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
}

/* Patient Profile Styles */
.profile-container {
    max-width: 1200px;
    margin: 6rem auto 2rem;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

.chat-box {
    height: 400px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.message {
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    max-width: 70%;
    word-wrap: break-word;
}

.message.sent {
    align-self: flex-end;
    background: var(--primary);
    color: white;
}

.message.received {
    align-self: flex-start;
    background: #e2e8f0;
    color: var(--dark);
}

.chat-input {
    display: flex;
    gap: 0.5rem;
}

.chat-input input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
}

.meal-entry {
    display: grid;
    grid-template-columns: 100px 1fr 100px auto;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.meal-entry:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Tablet Breakpoint */
@media (max-width: 992px) {
    .nav-links {
        gap: 1rem;
    }

    .hero h1 {
        font-size: 3rem;
    }

    .section-header h2 {
        font-size: 2rem;
    }

    .container {
        padding: 0 1.25rem;
    }
}

/* Mobile and Small Tablet */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    /* General Nav Links (Index) */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: white;
        flex-direction: column;
        padding: 6rem 2rem;
        gap: 1.5rem;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
        transition: 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
        align-items: flex-start;
        z-index: 999;
    }

    .nav-links.active {
        right: 0;
    }

    /* Overlay for nav menu */
    .nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: 0.3s;
        z-index: 998;
    }

    .nav-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Dashboard Layout */
    .dashboard-grid {
        grid-template-columns: 1fr;
        margin-top: 4rem;
        display: block;
    }

    /* Dashboard Sidebar */
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        background: white;
        z-index: 1002;
        transition: 0.3s ease;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
        padding-top: 5rem;
    }

    .sidebar.active {
        left: 0;
    }

    /* Overlay for sidebar */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
        opacity: 0;
        visibility: hidden;
        transition: 0.3s;
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    header {
        z-index: 1000;
    }

    /* Profile Container */
    .profile-container {
        grid-template-columns: 1fr;
        margin-top: 5rem;
        gap: 1.5rem;
        padding: 0 1rem;
    }

    .meal-entry {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        text-align: left;
        position: relative;
        padding-bottom: 3.5rem;
        /* Make room for button */
    }

    .meal-entry input[type="time"] {
        width: 100%;
        padding: 0.5rem;
        border: 1px solid #e2e8f0;
        border-radius: 0.375rem;
    }

    .meal-entry input[type="text"],
    .meal-entry input[type="number"] {
        width: 100%;
    }

    .meal-entry button {
        position: absolute;
        bottom: 1rem;
        right: 1rem;
        width: auto !important;
        padding: 0.5rem 1rem;
        background-color: #ef4444;
        color: white;
        border-radius: 0.375rem;
        font-size: 0.875rem;
    }

    .hero-container {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
    }

    .hero {
        height: auto;
        padding: 8rem 0 4rem;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero p {
        font-size: 1.1rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    section {
        padding: 3rem 0;
    }

    /* Larger touch targets for mobile */
    .btn {
        min-height: 44px;
        padding: 0.875rem 1.75rem;
    }

    /* Better card spacing on mobile */
    .card {
        padding: 1.25rem;
    }

    .feature-card {
        padding: 2rem;
    }

    /* Form improvements for mobile */
    .form-input {
        font-size: 16px;
        /* Prevents zoom on iOS */
        padding: 0.875rem 1rem;
    }

    /* Main content padding */
    .main-content {
        padding: 1.5rem;
    }
}

/* Small Mobile Phones */
@media (max-width: 480px) {
    .hero h1 {
        font-size: 2rem;
        line-height: 1.2;
    }

    .hero p {
        font-size: 1rem;
    }

    .section-header h2 {
        font-size: 1.75rem;
    }

    .nav-links,
    .sidebar {
        width: 100%;
    }

    .container {
        padding: 0 1rem;
    }

    .metric-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .btn {
        width: 100%;
        padding: 1rem;
    }

    /* Stack buttons vertically on very small screens */
    .hero-content>div {
        flex-direction: column;
        width: 100%;
    }

    .hero-content>div .btn {
        width: 100%;
    }
}

/* Dashboard specific mobile fixes */
@media (max-width: 768px) {
    .patient-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .patient-item>div {
        width: 100%;
    }

    .patient-item .btn {
        width: 100%;
        margin-bottom: 0.5rem;
        display: block;
        text-align: center;
    }

    /* Center align metrics on mobile */
    .metric-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .chart-container {
        height: 300px;
        padding: 1rem;
    }

    .btn-outline {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .dashboard-grid {
        margin-top: 4rem;
        gap: 1rem;
    }

    .main-content {
        padding: 1rem;
    }
}