:root {
    /* Colors */
    --primary: #f26a8d;
    /* Warm Coral / Pink */
    --primary-light: #fbe6ea;
    /* Very light pink background */
    --primary-dark: #d65073;

    --bg-color: #f7f9fa;
    /* Very soft grey/blue off-white */
    --card-bg: #ffffff;

    --text-main: #2d3748;
    /* Dark grey for high contrast */
    --text-light: #718096;
    /* Subtitle text */

    --border-color: #e2e8f0;

    /* Typography */
    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Shadows - Soft and friendly */
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Border Radius - Very rounded for approachability */
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    font-size: 18px;
    /* Slightly larger base font size for readability */
}

/* App Container */
.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
    padding-top: 1rem;
}

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

.logo-icon {
    font-size: 2.8rem;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-light);
    font-weight: 400;
}

/* Views Management */
.view {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.view.active-view {
    display: block;
}

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

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

/* Search Box */
.search-container {
    margin-bottom: 3rem;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 2px solid transparent;
    transition: all var(--transition-fast);
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.search-icon {
    font-size: 2rem;
    color: var(--text-light);
    margin-right: 1rem;
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.2rem;
    font-family: var(--font-family);
    color: var(--text-main);
    background: transparent;
}

.search-box input::placeholder {
    color: #a0aec0;
}

.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
}

.icon-btn:hover {
    color: var(--primary);
}

.icon-btn.hidden {
    display: none;
}

/* Categories Grid */
.section-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    user-select: none;
}

.card:hover,
.card:active {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.card-icon-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.card:hover .card-icon-wrapper {
    background-color: var(--primary);
    color: white;
}

.card .material-symbols-rounded {
    font-size: 3rem;
}

.card-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Common Header for Inner Views */
.view-header {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--card-bg);
    color: var(--text-main);
    border: 2px solid var(--border-color);
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-lg);
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    width: fit-content;
}

.nav-btn:hover,
.nav-btn:active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark);
    transform: translateX(-3px);
}

.nav-btn .material-symbols-rounded {
    font-size: 1.5rem;
}

/* Category View Specifics */
.category-header-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 2rem;
    color: var(--primary);
}

.category-header-title .material-symbols-rounded {
    font-size: 2.5rem;
}

.articles-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Article Link Items */
.article-item {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
}

.article-item:hover,
.article-item:active {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: translateX(5px);
}

.article-item-title {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-main);
}

.article-item .material-symbols-rounded {
    color: var(--text-light);
    font-size: 1.8rem;
    transition: color var(--transition-fast);
}

.article-item:hover .material-symbols-rounded {
    color: var(--primary);
}

.no-results {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
    font-size: 1.2rem;
}

/* Article Content View */
.article-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-sm);
}

#articleTitle {
    font-size: 2.2rem;
    color: var(--primary-dark);
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary-light);
}

.article-body {
    font-size: 1.2rem;
    color: var(--text-main);
    line-height: 1.8;
}

/* Markdown styling inside article body */
.article-body h2 {
    font-size: 1.6rem;
    color: var(--text-main);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.article-body h3 {
    font-size: 1.4rem;
    color: var(--text-main);
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
}

.article-body p {
    margin-bottom: 1.2rem;
}

.article-body ul,
.article-body ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.article-body li {
    margin-bottom: 0.5rem;
}

.article-body img {
    max-width: 100%;
    border-radius: var(--radius-md);
    margin: 1.5rem 0;
    box-shadow: var(--shadow-sm);
}

.article-body blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    color: var(--primary-dark);
    background-color: var(--primary-light);
    padding: 1rem 1.5rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 1.1rem;
    font-style: italic;
}

/* Login View */
#view-login.active-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.login-container {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    box-shadow: var(--shadow-sm);
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.pin-display {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.pin-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--border-color);
    transition: background-color var(--transition-fast);
}

.pin-dot.filled {
    background-color: var(--primary);
}

.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    justify-items: center;
}

.keypad-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background-color: var(--bg-color);
    border: 2px solid transparent;
    font-size: 1.8rem;
    font-weight: 600;
    font-family: var(--font-family);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.keypad-btn:hover,
.keypad-btn:active {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    transform: scale(1.05);
}

.icon-btn-keypad {
    background-color: transparent;
    box-shadow: none;
    color: var(--text-light);
}

.icon-btn-keypad:hover,
.icon-btn-keypad:active {
    background-color: transparent;
    color: var(--primary);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .app-container {
        padding: 1rem;
    }

    .logo {
        font-size: 2rem;
    }

    .categories-grid {
        grid-template-columns: 1fr 1fr;
    }

    .article-content {
        padding: 1.5rem;
    }

    #articleTitle {
        font-size: 1.8rem;
    }

    .nav-btn {
        width: 100%;
        justify-content: center;
    }
}