/* MSD Dark Blue Theme Stylesheet */

:root {
    /* Core palette */
    --bg: #0b1220;
    /* page background (near-black blue) */
    --surface: #131a2a;
    /* cards, panels */
    --surface-muted: #1b2436;
    /* inputs, subtle backgrounds */
    --primary: #4a90e2;
    /* accent blue */
    --primary-strong: #377ad1;
    /* hover/active */
    --accent: #78a7f0;
    /* lighter accent */
    --text: #e6eaf2;
    /* primary text */
    --text-muted: #b9c2d3;
    /* secondary text */
    --border: #263045;
    /* outlines/dividers */
    --success: #3fb984;
    --warning: #f0b94a;
    --danger: #e06b6b;
    --focus: #4a90e2aa;

    /* Compatibility with original variable names */
    --msd-teal: var(--primary);
    --msd-teal-light: var(--accent);
    --msd-teal-dark: var(--primary-strong);
    --msd-teal-pale: #16243a;
    /* subtle blue-tinted panel */
    --white: #ffffff;
    --light-gray: var(--bg);
    --medium-gray: var(--border);
    --dark-gray: #0a0f1a;
    --text-color: var(--text);

    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
    --transition: all 0.2s ease;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg);
}

/* Header */
.main-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.nav-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--text);
    text-decoration: none;
    padding: 0.5rem 0.875rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-weight: 500;
}

.nav-link:hover {
    background-color: var(--surface-muted);
}

.nav-link.logout {
    background-color: transparent;
    border: 1px solid var(--border);
}

.nav-link.logout:hover {
    background-color: var(--surface-muted);
}

/* Search */
.search-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.search-input {
    padding: 0.5rem 0.875rem;
    background: var(--surface-muted);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    outline: none;
    min-width: 200px;
    transition: var(--transition);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus);
}

.search-btn {
    padding: 0.5rem 0.875rem;
    background-color: var(--primary);
    color: #0b0f16;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.search-btn:hover {
    background-color: var(--primary-strong);
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 80px);
    padding: 2rem 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Cards and Layout */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    margin-bottom: 1.5rem;
}

.page-title {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.75rem;
    font-weight: 700;
}

/* Account Page */
.account-info {
    margin-bottom: 1.5rem;
}

.info-item {
    margin-bottom: 0.75rem;
    font-size: 1.05rem;
}

.account-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Posts Grid */
.posts-grid {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.post-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}


.post-title {
    color: var(--primary);
    margin-bottom: 0.75rem;
    font-size: 1.4rem;
    font-weight: 600;
}

.post-text {
    margin-bottom: 0.75rem;
    line-height: 1.7;
}

.post-example {
    background-color: var(--msd-teal-pale);
    padding: 0.75rem;
    border-radius: var(--border-radius);
    margin-bottom: 0.75rem;
}

.post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.post-date {
    font-style: italic;
}

.post-author {
    font-weight: 600;
    color: var(--primary);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.pagination-links {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.pagination-link {
    padding: 0.5rem 0.875rem;
    background-color: var(--surface);
    color: var(--text);
    text-decoration: none;
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.pagination-link:hover {
    background-color: var(--surface-muted);
    color: var(--text);
}

.pagination-current {
    padding: 0.5rem 0.875rem;
    background-color: var(--primary);
    color: #0b0f16;
    border-radius: var(--border-radius);
    font-weight: 600;
    border: none;
}

/* Forms */
.form-container {
    max-width: 500px;
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
}

.form {
    display: flex;
    flex-direction: column;
}

.form-fields {
    margin-bottom: 1.5rem;
}

.form-fields p {
    margin-bottom: 0.75rem;
}

.form-fields label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-fields input[type="text"],
.form-fields input[type="email"],
.form-fields input[type="password"],
.form-fields textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--surface-muted);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
}

.form-fields input::placeholder,
.form-fields textarea::placeholder {
    color: var(--text-muted);
}

.form-fields input:focus,
.form-fields textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus);
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    font-weight: 600;
    transition: var(--transition);
    font-size: 1rem;
    background: var(--surface-muted);
    color: var(--text);
}

.btn:hover {
    background: var(--surface);
}

.btn-primary {
    background-color: var(--primary);
    color: #0b0f16;
    border: none;
}

.btn-primary:hover {
    background-color: var(--primary-strong);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--surface-muted);
    color: var(--text);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.empty-state p {
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* Accessibility: focus */
:focus-visible {
    outline: 2px solid transparent;
    box-shadow: 0 0 0 3px var(--focus);
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        padding: 1rem;
    }

    .nav-links {
        justify-content: center;
        width: 100%;
    }

    .search-form {
        width: 100%;
        justify-content: center;
    }

    .search-input {
        min-width: 150px;
        flex: 1;
        max-width: 300px;
    }

    .container {
        padding: 0 1rem;
    }

    .post-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .account-actions {
        flex-direction: column;
    }

    .pagination-links {
        justify-content: center;
    }

    .form-container {
        margin: 0 1rem;
    }
}

@media (max-width: 480px) {
    .nav-links {
        flex-direction: column;
        gap: 0.5rem;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .post-title {
        font-size: 1.2rem;
    }

    .card,
    .post-card,
    .form-container {
        padding: 1rem;
    }
}

/* Hamburger Menu Button */
.nav-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    position: relative;
    z-index: 1001;
}

.nav-toggle .hamburger {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text);
    margin: 5px 0;
    transition: var(--transition);
    border-radius: 2px;
}

/* Animate hamburger to X when active */
.nav-toggle.active .hamburger:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active .hamburger:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active .hamburger:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Desktop navigation wrapper */
.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

/* Mobile-specific styles */
@media (max-width: 768px) {
    .navbar {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
        padding: 1rem;
        position: relative;
    }

    .nav-toggle {
        display: block;
        order: -1;
    }

    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;

        /* Hidden by default */
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    }

    /* Show navigation when active */
    .nav-links.active {
        max-height: 500px;
        /* Adjust based on your content */
        opacity: 1;
        padding: 1rem;
    }

    .nav-links {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }

    .nav-link {
        width: 100%;
        text-align: center;
        padding: 0.75rem;
    }

    .search-form {
        width: 100%;
        justify-content: center;
    }

    .search-input {
        flex: 1;
        min-width: 0;
    }
}

@media (max-width: 480px) {

    .nav-content {
        padding: 0.75rem;
    }

    .nav-links {
        padding: 0.75rem;
    }

    .nav-links.active {
        padding: 0.75rem;
    }
}

/* Reaction buttons */
.post-reactions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 1.2rem;
}

/* Base button style */
.reaction-button {
    background: none;
    border: none;
    padding: 0.2rem;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    font-size: 1.2rem;
    transition: color 0.15s ease, transform 0.1s ease;
}


/* Hover state */
.reaction-button:hover {
    color: #b3aeae;
    transform: scale(1.1);
}

/* Active (aria-pressed="true") state */
.reaction-button[aria-pressed="true"] {
    color: var(--success); /* main highlight color */
    transform: scale(1.15);
}

/* Optional: different color when dislike is active */
.dislike-button[aria-pressed="true"] {
    color: var(--danger);;
}

/* Reaction counts */
.reaction-count {
    font-size: 0.9rem;
    color: #777;
}
