/* static/css/base.css */

/* --- Global Resets & Box-Sizing --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px; /* Base font size */
    scroll-behavior: smooth;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif; /* Using Inter for a modern look */
    line-height: 1.6;
    color: var(--color-text-dark); /* Dark gray for readability */
    background-color: var(--color-background-light); /* Light background */
    min-height: 100vh; /* Ensure body takes full viewport height */
    display: flex;
    flex-direction: column;
}

/* --- Custom Color Variables --- */
:root {
    --color-vibrant-green: #00D05A;
    --color-light-aqua: #C3F3FF;
    --color-black: #000000;
    --color-muted-purple-gray: #5E515A;
    --color-darker-green: #63B95F;
    --color-pink-magenta: #DE50AA;

    /* Semantic colors based on palette */
    --color-primary: var(--color-vibrant-green);
    --color-secondary: var(--color-muted-purple-gray);
    --color-accent: var(--color-pink-magenta);
    --color-background-light: #f8f9fa; /* General light background */
    --color-background-dark: #2c3e50; /* For header/footer if dark */
    --color-text-dark: #333;
    --color-text-light: #ecf0f1;
    --color-border: #ced4da;
    --color-success: #28a745;
    --color-danger: #dc3545;
    --color-info: #17a2b8;
    --color-warning: #ffc107;
    --color-link: #007bff; /* Standard link blue */

    --color-primary-light: #E0F7FA; /* Light Blue-Green for subtle backgrounds */
    --color-accent-light: #ffebeb; /* Lighter pink for unread backgrounds */
}


/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', sans-serif;
    color: var(--color-black); /* Headings use black */
    margin-bottom: 0.5em;
    line-height: 1.2;
}

h1 { font-size: 2.5rem; } /* 40px */
h2 { font-size: 2rem; }   /* 32px */
h3 { font-size: 1.75rem; } /* 28px */
h4 { font-size: 1.5rem; }  /* 24px */
h5 { font-size: 1.25rem; } /* 20px */
h6 { font-size: 1rem; }    /* 16px */

p {
    margin-bottom: 1em;
}

a {
    color: var(--color-primary); /* Links use primary green */
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--color-darker-green); /* Darker green on hover */
    text-decoration: underline;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    transition: all 0.2s ease-in-out;
    -webkit-user-select: none;  /* For Safari */
    user-select: none;          /* For modern browsers */
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    color: #fff;
    background-color: var(--color-primary); /* Vibrant Green */
    border-color: var(--color-primary);
}

.btn-primary:hover {
    background-color: var(--color-darker-green);
    border-color: var(--color-darker-green);
}

.btn-secondary {
    color: #fff;
    background-color: var(--color-secondary); /* Muted Purple/Gray */
    border-color: var(--color-secondary);
}

.btn-secondary:hover {
    background-color: #4a404f; /* Slightly darker secondary */
    border-color: #4a404f;
}

.btn-accent { /* New button type for the pink color */
    color: #fff;
    background-color: var(--color-accent); /* Pink/Magenta */
    border-color: var(--color-accent);
}

.btn-accent:hover {
    background-color: #c43e8f; /* Slightly darker pink */
    border-color: #c43e8f;
}

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

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.btn-info {
    background-color: var(--color-info);
    color: var(--color-white);
}

.btn-info:hover {
    background-color: #138496;
    transform: translateY(-1px);
}

.btn-success {
    background-color: var(--color-success);
    color: var(--color-white);
}

.btn-success:hover {
    background-color: #218838;
    transform: translateY(-1px);
}

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

.btn-outline-primary:hover {
    color: #fff;
    background-color: var(--color-primary);
}

/* --- Forms --- */
.form-group {
    margin-bottom: 1rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--color-text-dark);
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    color: var(--color-text-dark);
    background-color: #fff;
    border-color: var(--color-primary); /* Focus border uses primary color */
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 208, 90, 0.25); /* Shadow uses primary color */
}

.form-label {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--color-black);
}

/* --- Layout Containers --- */
.container {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

/* Responsive containers - increased max-widths for larger screens */
@media (min-width: 576px) {
    .container { max-width: 540px; }
}
@media (min-width: 768px) {
    .container { max-width: 720px; }
}
@media (min-width: 992px) {
    .container { max-width: 1080px; }
}
@media (min-width: 1200px) {
    .container { max-width: 1320px; }
}
@media (min-width: 1400px) {
    .container { max-width: 1500px; }
}


.flex-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem; /* Spacing between items */
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- Utility Classes --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.py-1 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2 { padding-top: 1rem; padding-bottom: 1rem; }
.py-3 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-4 { padding-top: 2rem; padding-bottom: 2rem; }

.px-1 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-2 { padding-left: 1rem; padding-right: 1rem; }
.px-3 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-4 { padding-left: 2rem; padding-right: 2rem; }

.rounded-sm { border-radius: 0.25rem; }
.rounded { border-radius: 0.5rem; }
.rounded-lg { border-radius: 0.75rem; }
.rounded-xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }


.shadow-sm { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
.shadow-md { box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08); }
.shadow-lg { box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05); }

.bg-white { background-color: #fff; }
.bg-light { background-color: var(--color-background-light); }
.bg-primary { background-color: var(--color-primary); }
.bg-secondary { background-color: var(--color-secondary); }
.bg-accent { background-color: var(--color-accent); } /* New accent background */

.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-accent { color: var(--color-accent); } /* New accent text */
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-info { color: var(--color-info); }
.text-warning { color: var(--color-warning); }
.text-muted { color: #6c757d; }
.text-black { color: var(--color-black); } /* Explicit black text */

.ml-auto { margin-left: auto; }


/* --- Flash Messages --- */
.flash-messages-container {
    padding: 1rem 0; /* Padding around the messages */
}

.flash-message {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    opacity: 1;
    transition: opacity 0.5s ease-out;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08); /* Subtle shadow for messages */
}

.flash-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-message.danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.flash-message.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.flash-message.warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}


/* --- Mobile Responsiveness for common elements --- */
@media (max-width: 767.98px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }

    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }

    .form-control {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
}

/* --- Header & Footer (General Styles) --- */
header.main-header {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
    flex-wrap: wrap;
}

.logo-container {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--color-black);
    font-weight: 700;
    font-size: 1.5rem;
    gap: 0.75rem;
}

.app-logo {
    max-height: 50px;
    width: auto;
    border-radius: 0.5rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.app-name {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-primary);
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--color-text-dark);
    cursor: pointer;
    display: block; /* MODIFIED: Always show toggle button on mobile */
    position: absolute; /* MODIFIED: Position absolutely for better control */
    right: 1rem; /* MODIFIED */
    top: 1rem; /* MODIFIED */
}

.main-nav {
    width: 100%; /* MODIFIED: Take full width on mobile */
    display: none; /* MODIFIED: Hidden by default on mobile */
    flex-direction: column;
    align-items: flex-start;
    margin-top: 1rem;
    overflow-y: auto; /* ADDED: Allow scrolling if many nav items */
    max-height: calc(100vh - 100px); /* ADDED: Limit height to prevent overflow */
}

.main-nav.active {
    display: flex; /* Show when active */
}

.main-nav ul {
    list-style: none;
    width: 100%;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.main-nav li {
    margin-bottom: 0.5rem;
    width: 100%;
    text-align: center;
}

.main-nav a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--color-text-dark);
    text-decoration: none;
    transition: background-color 0.3s ease, color 0.3s ease;
    border-radius: 0.3rem;
    width: 100%;
    box-sizing: border-box;
    justify-content: center;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.main-nav a:hover {
    background-color: var(--color-light-aqua);
    color: var(--color-black);
}

.badge {
    display: inline-block;
    padding: 0.25em 0.4em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
}

.badge-danger {
    color: #fff;
    background-color: var(--color-danger);
}


/* Desktop navigation */
@media (min-width: 768px) {
    .menu-toggle {
        display: none; /* Hide on desktop */
    }

    .main-nav {
        display: flex; /* Always show on desktop */
        flex-direction: row;
        width: auto;
        margin-top: 0;
        max-height: none; /* ADDED: Remove max-height on desktop */
    }

    .main-nav ul {
        display: flex;
        align-items: center;
        gap: 1.5rem;
        width: auto;
        flex-direction: row;
    }

    .main-nav li {
        margin-bottom: 0;
        width: auto;
    }

    .main-nav a {
        padding: 0.5rem 0.75rem;
        width: auto;
    }

    .main-nav a.btn {
        padding: 0.5rem 1rem;
    }
}


footer.main-footer {
    background-color: var(--color-background-dark);
    color: var(--color-text-light);
    padding: 2rem 0;
    text-align: center;
    margin-top: auto;
}

footer.main-footer a {
    color: var(--color-primary);
}

footer.main-footer a:hover {
    color: var(--color-darker-green);
}
