
/* =========================================
   MY HEALTH DIARY
   PREMIUM GLOBAL DESIGN SYSTEM
   VERSION 2.0
========================================= */

:root {
    /* BRAND COLORS */
    --primary: #ec4899;
    --primary-dark: #db2777;
    --primary-light: #fce7f3;
    --primary-soft: #fff1f7;

    /* BACKGROUNDS */
    --white: #ffffff;
    --background: #fff8fb;
    --surface: #ffffff;
    --surface-soft: #fffafd;

    /* TEXT */
    --text: #292333;
    --text-light: #817687;
    --text-muted: #a69baa;

    /* STATUS */
    --success: #16a36a;
    --danger: #dc2626;
    --warning: #f59e0b;

    /* BORDERS */
    --border: #f4dce9;
    --border-light: #f9eaf1;

    /* SHADOWS */
    --shadow-sm: 0 3px 12px rgba(190,80,135,.05);
    --shadow-md: 0 8px 25px rgba(190,80,135,.09);
    --shadow-lg: 0 15px 40px rgba(190,80,135,.13);

    /* RADIUS */
    --radius-sm: 12px;
    --radius-md: 17px;
    --radius-lg: 22px;
    --radius-xl: 28px;

    /* LAYOUT */
    --app-width: 600px;
    --nav-height: 76px;
}


/* =========================================
   RESET
========================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
    min-height: 100%;
}

body {
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    background: var(--background);
    color: var(--text);

    min-height: 100vh;
    min-height: 100dvh;

    overflow-x: hidden;
    line-height: 1.5;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    border: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(236,72,153,.30);
    outline-offset: 3px;
}

.hidden {
    display: none !important;
}

::selection {
    background: var(--primary-light);
    color: var(--primary-dark);
}


/* =========================================
   APP LOADER
========================================= */

.app-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;

    display: flex;
    align-items: center;
    justify-content: center;

    background: var(--white);
}

.loader-content {
    width: 90%;
    text-align: center;
}

.loader-icon,
.loader-logo {
    width: 84px;
    height: 84px;

    margin: 0 auto 18px;

    display: grid;
    place-items: center;

    border-radius: 27px;

    background: linear-gradient(
        135deg,
        #fce7f3,
        #fbcfe8
    );

    color: var(--primary);
    font-size: 48px;

    box-shadow: var(--shadow-md);
}

.loader-content h2 {
    font-size: 24px;
    font-weight: 850;
    letter-spacing: -.5px;
}

.loader-content p {
    color: var(--text-light);
    font-size: 13px;
    margin-top: 8px;
}

.loader-spinner {
    width: 30px;
    height: 30px;

    border: 3px solid var(--primary-light);
    border-top-color: var(--primary);

    border-radius: 50%;
    margin: 25px auto 0;

    animation: loaderSpin .8s linear infinite;
}

@keyframes loaderSpin {
    to {
        transform: rotate(360deg);
    }
}


/* =========================================
   APP SCREENS
========================================= */

.screen {
    width: 100%;
    max-width: var(--app-width);

    min-height: 100vh;
    min-height: 100dvh;

    margin: 0 auto;
    padding: 20px;

    position: relative;
}

#dashboardScreen {
    padding-top: 22px;
    padding-bottom: calc(var(--nav-height) + 45px);
}

.dashboard-main {
    width: 100%;
}


/* =========================================
   LOGIN SCREEN
========================================= */

#loginScreen {
    display: flex;
    align-items: center;
    justify-content: center;

    background:
        radial-gradient(
            circle at 5% 5%,
            #fce7f3,
            transparent 35%
        ),
        radial-gradient(
            circle at 95% 95%,
            #fbcfe8,
            transparent 35%
        ),
        var(--background);
}

.login-container {
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-brand {
    margin-bottom: 25px;
}

.login-logo {
    width: 88px;
    height: 88px;

    margin: 0 auto 18px;

    display: grid;
    place-items: center;

    border-radius: 29px;

    background: linear-gradient(
        135deg,
        #ec4899,
        #f472b6
    );

    color: white;
    font-size: 52px;

    box-shadow: 0 14px 32px rgba(236,72,153,.28);
}

.login-brand h1 {
    font-size: 28px;
    font-weight: 850;
    letter-spacing: -.7px;
}

.login-brand p {
    color: var(--text-light);
    font-size: 14px;
    margin-top: 7px;
}

#setupBox,
#loginBox {
    margin-top: 24px;
    padding: 25px 21px;
    text-align: left;
}

#setupBox h2,
#loginBox h2 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 8px;
}

#setupBox > p,
#loginBox > p {
    color: var(--text-light);
    font-size: 13px;
    margin-bottom: 23px;
}

.auth-message {
    min-height: 20px;
    margin-top: 15px;

    color: var(--danger);
    font-size: 13px;
    line-height: 1.5;
}


/* =========================================
   COMMON CARDS
========================================= */

.content-card {
    background: var(--surface);

    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);

    padding: 20px;
    margin-bottom: 16px;

    box-shadow: var(--shadow-sm);

    transition:
        box-shadow .2s ease,
        border-color .2s ease;
}

.content-card h3 {
    font-size: 17px;
    font-weight: 750;
}


/* =========================================
   INPUT GROUPS
========================================= */

.input-group {
    margin-bottom: 18px;
}

.input-group label {
    display: block;

    font-size: 13px;
    font-weight: 750;

    margin-bottom: 9px;
    color: var(--text);
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    min-height: 52px;

    padding: 13px 15px;

    border: 1px solid var(--border);
    border-radius: 15px;

    background: var(--surface-soft);

    color: var(--text);
    font-size: 15px;

    outline: none;

    transition:
        border-color .2s ease,
        background .2s ease,
        box-shadow .2s ease;
}

.input-group textarea {
    min-height: 100px;
    resize: vertical;
}

.input-group input::placeholder,
.input-group textarea::placeholder {
    color: #b8aab6;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    border-color: var(--primary);
    background: white;

    box-shadow: 0 0 0 4px rgba(236,72,153,.09);
}


/* =========================================
   BUTTON SYSTEM
========================================= */

.primary-btn,
.secondary-btn,
.danger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-height: 49px;
    padding: 13px 18px;

    border-radius: 15px;

    font-size: 14px;
    font-weight: 800;

    transition:
        transform .18s ease,
        box-shadow .18s ease,
        opacity .18s ease;
}

.primary-btn {
    width: 100%;

    color: white;

    background: linear-gradient(
        135deg,
        #ec4899,
        #db2777
    );

    box-shadow: 0 7px 18px rgba(236,72,153,.20);
}

.secondary-btn {
    color: var(--primary-dark);
    background: var(--primary-light);
}

.danger-btn {
    color: var(--danger);
    background: #fee2e2;
}

.primary-btn:active,
.secondary-btn:active,
.danger-btn:active {
    transform: scale(.98);
}

.primary-btn:disabled,
.secondary-btn:disabled,
.danger-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
    box-shadow: none;
}


/* =========================================
   DASHBOARD HEADER
========================================= */

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;

    padding: 2px 0 23px;
}

.header-content {
    min-width: 0;
}

.header-small {
    color: var(--primary-dark);
    font-size: 11px;
    font-weight: 850;
    letter-spacing: 1.5px;
}

.app-header h2 {
    font-size: 23px;
    line-height: 1.3;
    font-weight: 850;
    letter-spacing: -.5px;

    margin-top: 5px;
}

#dashboardUserName {
    color: var(--primary-dark);
}

#currentDate {
    color: var(--text-light);
    font-size: 12px;
    margin-top: 7px;
}

.profile-button {
    flex-shrink: 0;

    width: 51px;
    height: 51px;

    display: grid;
    place-items: center;

    border-radius: 18px;

    background: linear-gradient(
        135deg,
        #fce7f3,
        #fbcfe8
    );

    color: var(--primary-dark);
    font-size: 25px;

    box-shadow: var(--shadow-sm);
    transition: transform .2s ease;
}

.profile-button:active {
    transform: scale(.94);
}


/* =========================================
   WELCOME BANNER
========================================= */

.welcome-card {
    min-height: 190px;

    position: relative;
    overflow: hidden;

    display: flex;
    align-items: center;

    padding: 27px 23px;

    color: white;

    border-radius: var(--radius-xl);

    background: linear-gradient(
        120deg,
        #ec4899,
        #db2777 60%,
        #be185d
    );

    box-shadow: 0 13px 30px rgba(190,24,93,.20);
}

.welcome-card::before {
    content: "";

    position: absolute;
    width: 180px;
    height: 180px;

    right: -65px;
    bottom: -100px;

    border-radius: 50%;
    background: rgba(255,255,255,.12);
}

.welcome-card::after {
    content: "";

    position: absolute;
    width: 100px;
    height: 100px;

    right: 45px;
    top: -65px;

    border-radius: 50%;
    background: rgba(255,255,255,.09);
}

.welcome-content {
    position: relative;
    z-index: 2;
    max-width: 85%;
}

.welcome-label {
    font-size: 10px !important;
    font-weight: 850;
    letter-spacing: 1.3px;
    opacity: .9 !important;
}

.welcome-card h2 {
    font-size: 23px;
    line-height: 1.35;
    font-weight: 850;

    margin: 12px 0;
}

.welcome-card p {
    font-size: 13px;
    line-height: 1.5;
    opacity: .93;
}

.welcome-heart {
    position: absolute;
    right: 18px;
    top: 35px;

    font-size: 85px;
    line-height: 1;

    color: white;
    opacity: .25;

    pointer-events: none;
}


/* =========================================
   DASHBOARD SECTIONS
========================================= */

.dashboard-section {
    margin-top: 29px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 10px;
    margin-bottom: 16px;
}

.section-heading h2 {
    font-size: 19px;
    line-height: 1.3;
    font-weight: 850;
    letter-spacing: -.3px;
}

.section-heading p {
    color: var(--text-light);
    font-size: 12px;
    margin-top: 5px;
}

.section-heading span {
    color: var(--text-light);
    font-size: 12px;
}


/* =========================================
   NOTIFICATION CENTER
========================================= */

.notification-card {
    position: relative;
    z-index: 2;
    padding: 20px;
}

.notification-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    margin-bottom: 18px;
}

.notification-heading h3 {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 5px;
}

.notification-heading p {
    color: var(--text-light);
    font-size: 12px;
    line-height: 1.5;
}

#notificationStatusIcon {
    flex-shrink: 0;
    font-size: 34px;
}

#enableNotificationsBtn {
    margin-bottom: 10px;
    position: relative;
    z-index: 3;
}

#testNotificationBtn,
#directTestNotificationBtn {
    position: relative;
    z-index: 5;

    width: 100%;
    min-height: 49px;

    pointer-events: auto;
    touch-action: manipulation;
    cursor: pointer;
}

#notificationTestResult {
    margin-top: 12px;

    color: var(--text-light);
    font-size: 12px;
    line-height: 1.5;

    overflow-wrap: anywhere;
}

#notificationTestResult:empty {
    display: none;
}


/* =========================================
   REMINDER CARDS
========================================= */

.reminder-card {
    padding: 20px;
}

.reminder-heading {
    display: flex;
    align-items: center;
    gap: 13px;

    margin-bottom: 17px;
}

.reminder-icon {
    flex-shrink: 0;

    width: 54px;
    height: 54px;

    display: grid;
    place-items: center;

    border-radius: 17px;

    background: linear-gradient(
        135deg,
        #fff1f7,
        #fce7f3
    );

    font-size: 27px;
}

.reminder-heading h3 {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 4px;
}

.reminder-heading p {
    color: var(--text-light);
    font-size: 12px;
}

.reminder-card hr {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: 17px 0;
}

.setting-row {
    min-height: 45px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    margin-bottom: 17px;

    font-size: 13px;
    font-weight: 750;

    cursor: pointer;
}

.setting-row input {
    flex-shrink: 0;

    width: 22px;
    height: 22px;

    accent-color: var(--primary);
    cursor: pointer;
}


/* =========================================
   TODAY OVERVIEW
========================================= */

.overview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 12px;
}

.overview-card {
    min-width: 0;

    display: block;

    padding: 17px 15px;

    background: white;
    border: 1px solid var(--border-light);
    border-radius: 19px;

    box-shadow: var(--shadow-sm);

    transition:
        transform .2s ease,
        box-shadow .2s ease,
        border-color .2s ease;
}

.overview-card:active {
    transform: scale(.97);
    border-color: var(--primary-light);
}

.overview-card > span {
    width: 43px;
    height: 43px;

    display: grid;
    place-items: center;

    border-radius: 14px;

    background: var(--primary-soft);
    font-size: 23px;

    margin-bottom: 12px;
}

.overview-card h3 {
    font-size: 23px;
    font-weight: 850;
    line-height: 1.2;

    margin-bottom: 5px;
}

.overview-card p {
    color: var(--text-light);
    font-size: 11px;
    font-weight: 600;
}


/* =========================================
   HEALTH FEATURE GRID
========================================= */

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 12px;

    padding-bottom: 15px;
}

.feature-card {
    min-width: 0;
    min-height: 148px;

    position: relative;

    display: flex;
    flex-direction: column;
    align-items: flex-start;

    padding: 17px 14px;

    background: white;

    border: 1px solid var(--border-light);
    border-radius: 19px;

    box-shadow: var(--shadow-sm);

    transition:
        transform .2s ease,
        border-color .2s ease,
        box-shadow .2s ease,
        background .2s ease;
}

.feature-card:active {
    transform: scale(.97);
    background: var(--primary-soft);
    border-color: var(--primary-light);
}

.feature-icon {
    width: 45px;
    height: 45px;

    display: grid;
    place-items: center;

    border-radius: 15px;

    background: linear-gradient(
        135deg,
        #fff1f7,
        #fce7f3
    );

    font-size: 24px;
    margin-bottom: 12px;
}

.feature-card h3 {
    font-size: 14px;
    font-weight: 800;
    line-height: 1.3;
}

.feature-card p {
    color: var(--text-light);
    font-size: 11px;
    line-height: 1.4;
    margin-top: 5px;
    padding-right: 15px;
}

.feature-arrow {
    position: absolute;
    right: 13px;
    bottom: 13px;

    color: var(--primary);
    font-size: 18px;
    font-weight: 800;
}


/* =========================================
   BOTTOM NAVIGATION
========================================= */

.bottom-navigation {
    position: fixed;
    bottom: 0;
    left: 50%;

    transform: translateX(-50%);

    width: 100%;
    max-width: var(--app-width);

    min-height: var(--nav-height);

    display: flex;
    align-items: center;
    justify-content: space-around;

    padding:
        9px 7px
        calc(9px + env(safe-area-inset-bottom));

    background: rgba(255,255,255,.97);

    border-top: 1px solid var(--border);

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    box-shadow: 0 -5px 20px rgba(190,80,135,.05);

    z-index: 100;
}

.nav-item {
    flex: 1;
    min-width: 0;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 4px;

    padding: 5px 2px;

    color: var(--text-muted);
    background: transparent;

    transition: color .2s ease;
}

.nav-item span {
    font-size: 23px;
    line-height: 1.2;
}

.nav-item p {
    font-size: 10px;
    font-weight: 750;
}

.nav-item.active {
    color: var(--primary-dark);
}

.nav-item.active span {
    transform: translateY(-1px);
}


/* =========================================
   TOAST MESSAGE
========================================= */

.toast-message {
    position: fixed;

    left: 50%;
    bottom: calc(var(--nav-height) + 20px);

    transform: translateX(-50%) translateY(20px);

    width: max-content;
    max-width: 90%;

    padding: 13px 19px;

    background: #292333;
    color: white;

    border-radius: 14px;

    font-size: 13px;
    font-weight: 600;

    text-align: center;

    z-index: 10000;

    opacity: 0;
    pointer-events: none;

    box-shadow: var(--shadow-lg);

    transition:
        opacity .25s ease,
        transform .25s ease;
}

.toast-message.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}


/* =========================================
   PROFILE COMPONENTS
   For profile page / profile modal
========================================= */

.profile-hero {
    padding: 25px 15px;

    margin-bottom: 20px;

    text-align: center;

    background: linear-gradient(
        135deg,
        #fce7f3,
        #fff1f7
    );

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.profile-avatar {
    width: 76px;
    height: 76px;

    margin: 0 auto 12px;

    display: grid;
    place-items: center;

    border-radius: 50%;

    background: linear-gradient(
        135deg,
        #ec4899,
        #db2777
    );

    color: white;
    font-size: 42px;
}

.profile-hero h2 {
    font-size: 21px;
    font-weight: 850;
}

.profile-hero p,
.profile-note {
    color: var(--text-light);
    font-size: 12px;
    margin-top: 6px;
}

#profileForm {
    padding-bottom: 20px;
}

#profileForm .primary-btn {
    margin-top: 5px;
}


/* =========================================
   COMMON MODULE UTILITIES
========================================= */

.form-row {
    display: flex;
    gap: 10px;
}

.form-row > * {
    flex: 1;
    min-width: 0;
}

.empty-state {
    padding: 35px 15px;
    text-align: center;
    color: var(--text-light);
}

.empty-state span {
    display: block;
    font-size: 42px;
    margin-bottom: 12px;
}


/* =========================================
   LEGACY PAGE COMPATIBILITY
   Will be removed after JS migration
========================================= */

.page-container {
    width: 100%;
    min-height: 65vh;
    padding-bottom: 110px;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 21px;
    font-weight: 800;
}

#backToDashboard {
    width: 43px;
    height: 43px;

    display: grid;
    place-items: center;

    border-radius: 14px;

    background: white;
    border: 1px solid var(--border);

    color: var(--primary);
    font-size: 24px;
}


/* =========================================
   INTERACTION PROTECTION
========================================= */

#enableNotificationsBtn,
#testNotificationBtn,
#directTestNotificationBtn,
#backToDashboard,
#profileBtn,
.feature-card,
.overview-card,
.nav-item {
    pointer-events: auto;
    touch-action: manipulation;
}

#directTestNotificationBtn::before,
#directTestNotificationBtn::after {
    pointer-events: none;
}


/* =========================================
   TABLET & DESKTOP
========================================= */

@media (min-width: 500px) {

    .screen {
        padding: 25px;
    }

    #dashboardScreen {
        padding-bottom: 125px;
    }

    .overview-grid {
        grid-template-columns: repeat(4, minmax(0,1fr));
    }

    .feature-grid {
        grid-template-columns: repeat(3, minmax(0,1fr));
    }

    .bottom-navigation {
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
        border-radius: 18px 18px 0 0;
    }
}


/* =========================================
   SMALL MOBILE
========================================= */

@media (max-width: 350px) {

    .screen {
        padding: 15px;
    }

    .app-header h2 {
        font-size: 19px;
    }

    .welcome-card {
        min-height: 175px;
        padding: 22px 18px;
    }

    .welcome-card h2 {
        font-size: 20px;
    }

    .content-card {
        padding: 16px;
    }

    .feature-grid,
    .overview-grid {
        gap: 9px;
    }

    .feature-card {
        padding: 14px 11px;
        min-height: 140px;
    }

    .feature-card h3 {
        font-size: 13px;
    }
}


/* =========================================
   ACCESSIBILITY
========================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}


/* =========================================
   FIX: DEFAULT BLUE / PURPLE LINK COLORS
   MY HEALTH DIARY
========================================= */

/* Feature Cards */
a.feature-card,
a.feature-card:link,
a.feature-card:visited,
a.feature-card:hover,
a.feature-card:active {
    color: inherit !important;
    text-decoration: none !important;
}

/* Overview Cards */
a.overview-card,
a.overview-card:link,
a.overview-card:visited,
a.overview-card:hover,
a.overview-card:active {
    color: inherit !important;
    text-decoration: none !important;
}

/* Bottom Navigation */
a.nav-item,
a.nav-item:link,
a.nav-item:visited,
a.nav-item:hover,
a.nav-item:active {
    color: inherit !important;
    text-decoration: none !important;
}

/* All Card Text */
.feature-card *,
.overview-card *,
.nav-item * {
    text-decoration: none !important;
}

/* Dashboard Text */
.dashboard-section h1,
.dashboard-section h2,
.dashboard-section h3,
.welcome-card h1,
.welcome-card h2 {
    text-decoration: none !important;
}

/* Remove default blue underlines from app cards */
a.feature-card,a.overview-card,a.nav-item{color:inherit;text-decoration:none}a.feature-card:visited,a.overview-card:visited,a.nav-item:visited{color:inherit}
