/* Proppin - Main Public Stylesheet */

:root {
    --primary-color: #007bff; /* A nice blue */
    --secondary-color: #6c757d;
    --light-bg: #f8f9fa;
    --dark-text: #212529;
    --light-text: #ffffff;
    --border-color: #dee2e6;
    --font-family: 'IBM Plex Sans Thai', sans-serif;
}

body {
    font-family: var(--font-family);
    margin: 0;
    color: var(--dark-text);
    background-color: var(--light-bg);
    line-height: 1.6;
}

.main-header {
    background-color: var(--light-text);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: auto;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--primary-color);
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--dark-text);
    cursor: pointer;
    padding: 0.5rem;
}

.nav-content {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-menu {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
    gap: 1.5rem;
}

.nav-menu a {
    text-decoration: none;
    color: var(--dark-text);
    font-weight: 500;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.dropdown-icon {
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.nav-auth {
    display: flex;
    align-items: center;
}

.nav-auth a {
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    margin-left: 0.5rem;
    transition: all 0.3s;
}

.user-welcome {
    margin-right: 1rem;
    font-weight: 500;
}

.btn.btn-primary {
    background-color: var(--primary-color);
    color: var(--light-text);
    border: 1px solid var(--primary-color);
}
.btn.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.btn.btn-secondary {
    background-color: transparent;
    color: var(--dark-text);
    border: 1px solid var(--border-color);
}
.btn.btn-secondary:hover {
    background-color: var(--light-bg);
}


.main-content {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.main-footer {
    background-color: #343a40;
    color: var(--light-text);
    padding: 2rem;
    text-align: center;
    margin-top: 2rem;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin-top: 1rem;
}

.footer-links li {
    display: inline;
    margin: 0 10px;
}

.footer-links a {
    color: var(--light-text);
    text-decoration: none;
}

/* Authentication Forms */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 0;
    min-height: calc(100vh - 140px); /* Adjust based on header/footer height */
}

.auth-form {
    background: var(--light-text);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border-color);
}

.auth-form h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

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

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

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    box-sizing: border-box; /* Important for width 100% */
}

.btn-block {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
}

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
}

/* Dropdown Menu Styles */
.nav-dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1001;
    list-style: none;
    padding: 0;
    margin: 0;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    top: 100%;
    left: 0;
}

.dropdown-content li a {
    color: var(--dark-text);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    white-space: nowrap;
}

.dropdown-content li a:hover {
    background-color: #f1f1f1;
    color: var(--primary-color);
}

.nav-dropdown:hover .dropdown-content {
    display: block;
}

/* Page Content Styles */
.page-container {
    background-color: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.page-content {
    margin-top: 1.5rem;
}

/* Latest Posts Grid */
.ej-latest-posts_grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.latest-posts-item a {
    display: block;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
    background-color: var(--light-text);
}

.latest-posts-item a:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.latest-posts-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.latest-posts-item h3 {
    font-size: 1.1rem;
    padding: 1rem;
    margin: 0;
}

/* Latest Posts List */
.ej-latest-posts_list {
    list-style: none;
    padding-left: 0;
    margin-top: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--light-text);
}

.ej-latest-posts_list li {
    border-bottom: 1px solid var(--border-color);
}
.ej-latest-posts_list li:last-child {
    border-bottom: none;
}

.ej-latest-posts_list li a {
    display: block;
    padding: 0.85rem 1.25rem;
    text-decoration: none;
    color: var(--dark-text);
    transition: background-color 0.2s ease;
}

.ej-latest-posts_list li a:hover {
    background-color: var(--light-bg);
    color: var(--primary-color);
}

/* --- Responsive Styles --- */
@media (max-width: 768px) {
    .main-header {
        padding: 0 1.5rem;
    }

    .main-nav {
        justify-content: space-between;
        position: relative;
    }

    .nav-brand {
        width: 100%;
        justify-content: space-between;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .nav-content {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #fff;
        flex-direction: column;
        align-items: stretch;
        padding: 1rem 1.5rem;
        gap: 1rem;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        border-top: 1px solid var(--border-color);
        display: none;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
    }

    .nav-content.is-active {
        display: flex;
    }

    .nav-menu {
        flex-direction: column;
        width: 100%;
        gap: 0;
    }

    .nav-menu li {
        width: 100%;
        border-bottom: 1px solid var(--light-bg);
    }

    .nav-menu li:last-child {
        border-bottom: none;
    }

    .nav-menu a {
        padding: 1rem 0;
        width: 100%;
        justify-content: space-between;
    }

    .nav-dropdown:hover .dropdown-content {
        display: none; /* Disable hover on mobile */
    }

    .nav-dropdown.is-open .dropdown-content {
        display: block;
        position: static;
        box-shadow: none;
        border: none;
        background-color: var(--light-bg);
        padding-left: 1rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .nav-dropdown.is-open .dropdown-icon {
        transform: rotate(180deg);
    }

    .nav-auth {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
        padding-top: 1rem;
        border-top: 1px solid var(--border-color);
    }

    .nav-auth a {
        width: 100%;
        text-align: center;
        margin: 0;
        box-sizing: border-box;
    }

    .user-welcome {
        margin: 0 0 0.5rem 0;
        text-align: center;
    }
}
