/* public/css/main.css - Examoo Green & White Theme */

/* ===== ROOT VARIABLES ===== */
:root {
    --primary-green: #22c55e;
    --primary-green-dark: #16a34a;
    --primary-green-light: #86efac;
    --bg-white: #ffffff;
    --bg-gray-50: #f9fafb;
    --bg-gray-100: #f3f4f6;
    --text-dark: #1f2937;
    --text-gray: #6b7280;
    --text-light: #9ca3af;
    --border-gray: #e5e7eb;
    --hover-bg: #f3f4f6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-gray-50);
    color: var(--text-dark);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

/* ===== LAYOUT STRUCTURE ===== */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1280px;
    margin: 0 auto;
    flex: 1;
}

.app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    flex: 1;
}

.content-wrapper {
    display: flex;
    flex: 1;
    margin-top: 60px;
    /* Height of topbar */
}

/* This targets the <main> in static pages using header.php */
body>main {
    flex: 1;
}

/* ===== TOP BAR ===== */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-gray);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.topbar-logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-green);
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-search {
    flex: 1;
    max-width: 500px;
    margin: 0 20px;
}

.topbar-search input {
    width: 100%;
    padding: 8px 16px;
    border: 1px solid var(--border-gray);
    border-radius: 20px;
    background: var(--bg-gray-50);
    font-size: 14px;
}

.topbar-search input:focus {
    outline: none;
    border-color: var(--primary-green);
    background: var(--bg-white);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
    position: relative;
}

.topbar-icon:hover {
    background: var(--hover-bg);
}

.topbar-icon .badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--primary-green);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
}

.topbar-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-gray);
    cursor: pointer;
}

/* ===== TOP BAR HAMBURGER ===== */
.topbar-hamburger {
    font-size: 24px;
    color: var(--text-dark);
    margin-right: 15px;
    padding: 5px 10px;
    border-radius: 6px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar-hamburger:hover {
    background: var(--hover-bg);
}

/* ===== LEFT SIDEBAR ===== */
.left-sidebar {
    position: fixed;
    left: 0;
    top: 60px;
    width: 260px;
    height: calc(100vh - 60px);
    background: var(--bg-white);
    border-right: 1px solid var(--border-gray);
    padding: 10px 0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.3s ease, transform 0.3s ease;
    z-index: 999;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav-item {
    position: relative;
    width: 100%;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s;
    color: var(--text-dark);
    cursor: pointer;
    white-space: nowrap;
}

.sidebar-nav-link:hover {
    background: var(--hover-bg);
    color: var(--primary-green);
}

.sidebar-nav-link.active {
    color: var(--primary-green);
    background: var(--bg-gray-50);
}

.sidebar-nav-link.active::after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-green);
}

.sidebar-nav-icon {
    width: 24px;
    height: 24px;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Submenu Styles */
.submenu-arrow {
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.2s;
}

.has-submenu.open .submenu-arrow {
    transform: rotate(180deg);
}

.sidebar-submenu {
    list-style: none;
    background: #fcfdfd;
    padding: 0;
    /* Default closed for accordion behavior if needed, or controlled by JS/CSS hover */
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.has-submenu.open .sidebar-submenu {
    max-height: 500px;
}

.sidebar-submenu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px 10px 52px;
    font-size: 14px;
    color: var(--text-gray);
    transition: all 0.2s;
}

.sidebar-submenu-link:hover {
    color: var(--primary-green);
    background: var(--hover-bg);
}

.sidebar-submenu-link.active {
    color: var(--primary-green);
    font-weight: 600;
}

/* Stats Card */
.sidebar-stats-card {
    margin: 20px 16px;
    padding: 16px;
    background: var(--bg-gray-50);
    border: 1px solid var(--border-gray);
    border-radius: 12px;
    transition: opacity 0.3s;
}

/* Sidebar Collapsed State */
.left-sidebar.collapsed {
    width: 70px;
}

.left-sidebar.collapsed .sidebar-nav-link span:not(.sidebar-nav-icon),
.left-sidebar.collapsed .submenu-arrow,
.left-sidebar.collapsed .sidebar-submenu,
.left-sidebar.collapsed .sidebar-stats-card {
    opacity: 0;
    pointer-events: none;
}

.left-sidebar.collapsed .sidebar-nav-link {
    padding: 12px 23px;
    justify-content: center;
}

/* Hover Auto-Expand */
.left-sidebar.collapsed:hover {
    width: 260px;
}

.left-sidebar.collapsed:hover .sidebar-nav-link span,
.left-sidebar.collapsed:hover .submenu-arrow,
.left-sidebar.collapsed:hover .sidebar-stats-card {
    opacity: 1;
}

/* ===== MAIN CONTENT ===== */
.main-layout-container {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 60px);
    transition: margin-left 0.3s ease;
}

.main-layout-container.expanded {
    margin-left: 70px;
}

.main-layout-row {
    display: flex;
    flex: 1;
    width: 100%;
}

.main-content {
    flex: 1;
    min-height: 100%;
    border-right: 1px solid var(--border-gray);
    max-width: 600px;
}

/* ===== RIGHT SIDEBAR ===== */
.right-sidebar {
    position: sticky;
    top: 60px;
    width: 350px;
    height: fit-content;
    max-height: calc(100vh - 60px);
    padding: 20px;
    overflow-y: auto;
    flex-shrink: 0;
}

/* ===== POST COMPOSER ===== */
.post-composer {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-gray);
    padding: 16px;
}

.composer-form {
    display: flex;
    gap: 12px;
}

.composer-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.composer-input-wrapper {
    flex: 1;
}

.composer-textarea {
    width: 100%;
    border: none;
    resize: none;
    font-size: 16px;
    padding: 12px 0;
    font-family: inherit;
    color: var(--text-dark);
}

.composer-textarea:focus {
    outline: none;
}

.composer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.composer-icons {
    display: flex;
    gap: 12px;
}

.composer-icon-btn {
    color: var(--primary-green);
    font-size: 20px;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.composer-icon-btn:hover {
    background: var(--bg-gray-100);
}

.btn-post {
    background: var(--primary-green);
    color: white;
    padding: 10px 24px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 15px;
    transition: background 0.2s;
}

.btn-post:hover {
    background: var(--primary-green-dark);
}

.btn-post:disabled {
    background: var(--bg-gray-100);
    color: var(--text-light);
    cursor: not-allowed;
}

/* ===== FEED POST ===== */
.feed-post {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-gray);
    padding: 16px;
    transition: background 0.2s;
}

.feed-post:hover {
    background: var(--bg-gray-50);
}

.post-header {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.post-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.post-user-info {
    flex: 1;
}

.post-user-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-dark);
}

.post-username {
    color: var(--text-gray);
    font-size: 14px;
}

.post-time {
    color: var(--text-light);
    font-size: 14px;
}

.post-content {
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.post-actions {
    display: flex;
    justify-content: space-around;
    padding-top: 8px;
    border-top: 1px solid var(--border-gray);
}

.post-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-gray);
    transition: all 0.2s;
}

.post-action-btn:hover {
    background: var(--bg-gray-100);
    color: var(--primary-green);
}

.post-action-btn.liked {
    color: var(--primary-green);
}

/* ===== WIDGETS (Right Sidebar) ===== */
.widget {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border-gray);
}

.widget-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 16px;
    color: var(--text-dark);
}

.user-suggestion {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-gray);
}

.user-suggestion:last-child {
    border-bottom: none;
}

.suggestion-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.suggestion-info {
    flex: 1;
}

.suggestion-name {
    font-weight: 600;
    font-size: 14px;
}

.suggestion-username {
    font-size: 13px;
    color: var(--text-gray);
}

.btn-follow {
    background: var(--primary-green);
    color: white;
    padding: 6px 16px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
}

.btn-follow:hover {
    background: var(--primary-green-dark);
}

/* ===== UTILITIES ===== */
.hidden {
    display: none;
}

.text-green {
    color: var(--primary-green);
}

.text-gray {
    color: var(--text-gray);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .main-layout-container {
        margin-left: 0 !important;
    }

    .right-sidebar {
        display: none;
    }

    .main-content {
        max-width: none;
        border-right: none;
    }
}

@media (max-width: 768px) {
    .left-sidebar {
        transform: translateX(-100%);
        width: 260px;
    }

    .left-sidebar.show {
        transform: translateX(0);
    }

    .main-layout-container {
        margin-left: 0 !important;
    }
}

/* ===== UNIVERSAL FOOTER ===== */
.app-footer {
    background: #1f2937;
    color: white;
    padding: 60px 20px 20px;
    margin-top: 40px;
    border-top: 4px solid var(--primary-green);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col h4 {
    color: var(--primary-green);
    font-size: 18px;
    margin-bottom: 20px;
    font-weight: 600;
}

.footer-logo {
    font-size: 24px;
    font-weight: bold;
    color: white;
    margin-bottom: 20px;
}

.footer-bio {
    font-size: 14px;
    color: #9ca3af;
    line-height: 1.6;
    margin-bottom: 20px;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: #d1d5db;
    font-size: 14px;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--primary-green);
}

.footer-social {
    display: flex;
    gap: 15px;
}

.social-icon {
    font-size: 13px;
    color: #9ca3af;
}

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

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 20px;
    border-top: 1px solid #374151;
    text-align: center;
    color: #6b7280;
    font-size: 13px;
}

/* Mobile Adjustments for Footer */
@media (max-width: 600px) {
    .footer-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-social {
        justify-content: center;
    }
}