/* ==========================================================================
   1. CSS VARIABLES
   ========================================================================== */
:root {
    /* Light Mode */
    --ut-bg-body: #ffffff;
    --ut-bg-sidebar: #ffffff;
    --ut-bg-hover: #f1f1f2;
    --ut-text-main: #161823;
    --ut-text-muted: #8a8b91;
    --ut-border: #e3e3e4;
    --ut-primary: #ff0050; /* Default, overridden by Customizer */
    --ut-primary-hover: #e00045;
    
    /* Dimensions */
    --ut-sidebar-width: 240px;
    --ut-sidebar-collapsed-width: 70px; 
    --ut-header-height-mobile: 60px;
    --ut-footer-height-mobile: 60px;
}

/* Dark Mode */
body.ut-dark-mode {
    --ut-bg-body: #121212;
    --ut-bg-sidebar: #121212;
    --ut-bg-hover: #1f1f1f;
    --ut-text-main: #ffffff;
    --ut-text-muted: #a7a7a7;
    --ut-border: #2f2f2f;
}

/* ==========================================================================
   2. BASE STYLES
   ========================================================================== */
* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--ut-bg-body);
    color: var(--ut-text-main);
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; padding: 0; margin: 0; }
button { border: none; background: none; cursor: pointer; font-family: inherit; }

/* ==========================================================================
   3. WORDPRESS ADMIN BAR HANDLING
   ========================================================================== */
#wpadminbar {
    position: fixed; top: 0; left: 0; width: 100%; height: 32px; z-index: 99999;
}
body.admin-bar .ut-desktop-sidebar { top: 32px !important; height: calc(100vh - 32px) !important; }
body.admin-bar .ut-secondary-panel { top: 32px !important; height: calc(100vh - 32px) !important; }
body.admin-bar .ut-mobile-header { top: 32px !important; }

/* ==========================================================================
   4. MOBILE HEADER
   ========================================================================== */
.ut-mobile-header {
    display: none; 
    position: fixed; top: 0; left: 0; width: 100%; height: var(--ut-header-height-mobile);
    background: var(--ut-bg-body); border-bottom: 1px solid var(--ut-border);
    z-index: 9999;
    align-items: center; justify-content: space-between; padding: 0 15px;
}
.ut-mobile-logo-area { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }

.ut-mobile-actions { 
    display: flex; 
    align-items: center; 
    gap: 20px; 
    font-size: 22px; 
}

.ut-mobile-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.ut-mobile-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background-color: var(--ut-primary);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    border: 1px solid var(--ut-bg-body);
}

/* --- MOBILE HAMBURGER MENU --- */
.ut-mobile-menu-dropdown {
    display: none;
    position: fixed;
    top: var(--ut-header-height-mobile);
    left: 0;
    width: 100%;
    background: var(--ut-bg-body);
    border-bottom: 1px solid var(--ut-border);
    padding: 20px;
    z-index: 9998;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    animation: utSlideDown 0.3s ease;
}
.ut-mobile-menu-dropdown.active { display: block; }
@keyframes utSlideDown { from { opacity:0; transform:translateY(-10px); } to { opacity:1; transform:translateY(0); } }

.ut-mobile-menu-link {
    display: block;
    padding: 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--ut-text-main);
    border-bottom: 1px solid var(--ut-border);
    transition: color 0.2s;
}
.ut-mobile-menu-link:last-child { border-bottom: none; }
.ut-mobile-menu-link:hover { color: var(--ut-primary); }

/* --- MOBILE PROFILE MODAL --- */
.ut-mobile-profile-modal {
    display: none;
    position: fixed;
    top: 55px;
    right: 15px;
    width: 220px;
    background: var(--ut-bg-body);
    border: 1px solid var(--ut-border);
    border-radius: 16px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    padding: 10px;
    z-index: 10000;
    animation: utFadeIn 0.2s ease;
}
@keyframes utFadeIn { from { opacity:0; transform:scale(0.95); } to { opacity:1; transform:scale(1); } }

.ut-mobile-profile-modal.active { display: block; }

.ut-profile-menu-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    color: var(--ut-text-main);
    transition: background 0.2s;
}
.ut-profile-menu-item:hover { background: var(--ut-bg-hover); }
.ut-profile-menu-item i { margin-right: 12px; width: 20px; text-align: center; color: var(--ut-text-muted); }
.ut-profile-menu-item:hover i { color: var(--ut-primary); }

/* --- MOBILE SEARCH MODAL --- */
.ut-mobile-search-modal {
    display: none;
    position: fixed;
    top: var(--ut-header-height-mobile);
    left: 0;
    width: 100%;
    background: var(--ut-bg-body);
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    z-index: 9998;
    border-bottom: 1px solid var(--ut-border);
    animation: utSlideDown 0.3s ease;
}
.ut-mobile-search-modal.active { display: block; }

.ut-mobile-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.ut-search-input-wrapper {
    position: relative;
    flex-grow: 1;
    display: flex;
    align-items: center;
}

.ut-mobile-search-input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border-radius: 99px;
    border: 1px solid var(--ut-border);
    background: var(--ut-bg-hover);
    color: var(--ut-text-main);
    outline: none;
    font-size: 16px;
}

.ut-mobile-mic-icon {
    position: absolute;
    right: 15px;
    color: var(--ut-text-muted);
    cursor: pointer;
}

.ut-mobile-search-btn {
    background: var(--ut-primary);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 99px;
    font-weight: 600;
    cursor: pointer;
}

/* ==========================================================================
   5. DESKTOP SIDEBAR
   ========================================================================== */
.ut-desktop-sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: var(--ut-sidebar-width);
    height: 100vh;
    background: var(--ut-bg-sidebar);
    border-right: 1px solid var(--ut-border);
    z-index: 900;
    padding: 20px 10px;
    overflow-y: scroll;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    transition: width 0.3s ease;
}
.ut-desktop-sidebar::-webkit-scrollbar { display: none; }

/* --- COLLAPSED STATE --- */
.ut-desktop-sidebar.ut-collapsed {
    width: var(--ut-sidebar-collapsed-width);
    padding: 20px 0;
    align-items: center;
}

.ut-sidebar-logo {
    display: flex; align-items: center; gap: 8px; font-size: 24px; font-weight: 800;
    margin-bottom: 20px; padding: 0 10px; white-space: nowrap; overflow: hidden;
}

.ut-desktop-sidebar.ut-collapsed .ut-logo-text { display: none; }
.ut-desktop-sidebar.ut-collapsed .ut-sidebar-logo { justify-content: center; padding: 0; }

/* Search Trigger */
.ut-sidebar-search-trigger {
    background: var(--ut-bg-hover);
    border-radius: 99px;
    display: flex; align-items: center;
    padding: 12px;
    margin-bottom: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.ut-desktop-sidebar.ut-collapsed .ut-sidebar-search-trigger {
    background: transparent; justify-content: center; padding: 12px 0;
}

.ut-search-placeholder-text { margin-left: 10px; color: var(--ut-text-muted); }
.ut-desktop-sidebar.ut-collapsed .ut-search-placeholder-text { display: none; }

/* Nav Items */
.ut-nav-item {
    display: flex; align-items: center; padding: 12px 10px;
    border-radius: 8px; font-weight: 600; font-size: 16px;
    transition: background 0.2s; cursor: pointer; color: var(--ut-text-main);
    margin-bottom: 2px;
    white-space: nowrap; overflow: hidden;
}

.ut-nav-item:hover, .ut-nav-item.active { background-color: var(--ut-bg-hover); color: var(--ut-primary); }
.ut-nav-icon { width: 32px; font-size: 20px; display: flex; justify-content: center; flex-shrink: 0; }

.ut-desktop-sidebar.ut-collapsed .ut-nav-label { display: none; }
.ut-desktop-sidebar.ut-collapsed .ut-nav-item { justify-content: center; padding: 12px 0; }
.ut-desktop-sidebar.ut-collapsed .ut-coin-balance { display: none; }
.ut-following-section { margin-top: 20px; border-top: 1px solid var(--ut-border); padding-top: 20px; }
.ut-desktop-sidebar.ut-collapsed .ut-following-section { display: none; }
.ut-nav-item.ut-new-post { color: var(--ut-primary); }

/* ==========================================================================
   6. SECONDARY PANELS
   ========================================================================== */
.ut-secondary-panel {
    position: fixed; top: 0; left: 70.5px; width: 330px; height: 100vh;
    background: var(--ut-bg-body); border-right: 1px solid var(--ut-border);
    z-index: 899; transform: translateX(-100%); opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none; padding: 20px; overflow-y: auto;
}

.ut-secondary-panel.ut-active { transform: translateX(0); opacity: 1; pointer-events: auto; }
.ut-panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.ut-panel-title { font-weight: 700; font-size: 24px; }
.ut-panel-close { font-size: 20px; cursor: pointer; padding: 5px; }

.ut-panel-search-input { width: 100%; padding: 12px 15px; border-radius: 99px; background: var(--ut-bg-hover); border: none; outline: none; color: var(--ut-text-main); font-size: 16px; }
.ut-recent-searches { margin-top: 20px; }
.ut-recent-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; color: var(--ut-text-muted); cursor: pointer; }
.ut-recent-item:hover { background: var(--ut-bg-hover); padding-left: 5px; border-radius: 4px; }

.ut-more-item { display: flex; justify-content: space-between; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--ut-border); font-weight: 600; cursor: pointer; }
.ut-more-item:hover { color: var(--ut-primary); }

/* Switch Toggle */
.ut-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.ut-switch input { opacity: 0; width: 0; height: 0; }
.ut-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.ut-slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .ut-slider { background-color: #00d14a; }
input:checked + .ut-slider:before { transform: translateX(20px); }

/* ==========================================================================
   7. MAIN CONTENT
   ========================================================================== */
.ut-main-content {
    margin-left: 0;
    padding-top: var(--ut-header-height-mobile);
    padding-bottom: var(--ut-footer-height-mobile);
    min-height: 200vh;
}

.ut-content-inner { 
    max-width: 600px; 
    margin: 0 auto; 
    padding: 20px 15px 30px 15px;
}

.ut-breadcrumb {
    font-size: 12px;
    color: var(--ut-text-muted);
    margin-bottom: 10px;
}

.ut-page-title {
    font-size: 24px;
    font-weight: 800;
    margin: 0 0 20px 0;
}

.ut-coming-soon {
    font-size: 16px;
    color: var(--ut-text-muted);
    background: var(--ut-bg-hover);
    padding: 40px;
    text-align: center;
    border-radius: 12px;
    border: 1px solid var(--ut-border);
}

/* ==========================================================================
   8. MOBILE FOOTER
   ========================================================================== */
.ut-mobile-footer {
    display: none; position: fixed; bottom: 0; left: 0; width: 100%; height: var(--ut-footer-height-mobile);
    background: var(--ut-bg-body); border-top: 1px solid var(--ut-border);
    z-index: 9999;
    align-items: center; justify-content: space-around;
}
.ut-footer-item { display: flex; flex-direction: column; align-items: center; color: var(--ut-text-muted); font-size: 10px; gap: 4px; position: relative; cursor: pointer; text-decoration: none; }
.ut-footer-item i { font-size: 24px; }
.ut-footer-item.active { color: var(--ut-text-main); }

.ut-footer-add-btn { 
    background: var(--ut-text-main); 
    color: var(--ut-bg-body); 
    width: 45px; 
    height: 32px; 
    border-radius: 8px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    position: relative; 
}
.ut-footer-add-btn::before { content: ''; position: absolute; left: -3px; width: 100%; height: 100%; background: #00f2ea; border-radius: 8px; z-index: -1; }
.ut-footer-add-btn::after { content: ''; position: absolute; right: -3px; width: 100%; height: 100%; background: #ff0050; border-radius: 8px; z-index: -2; }

/* ==========================================================================
   9. RESPONSIVE QUERIES
   ========================================================================== */
@media (min-width: 1024px) {
    .ut-desktop-sidebar { display: flex; flex-direction: column; }
    .ut-main-content { margin-left: var(--ut-sidebar-width); padding-top: 0; padding-bottom: 0; }
    .ut-mobile-header { display: none !important; }
    .ut-mobile-footer { display: none !important; }
    .ut-content-inner { padding: 40px; max-width: 800px; }
    
    body.ut-sidebar-mode-collapsed .ut-main-content {
        margin-left: calc(70px + 330px);
    }
}

@media (max-width: 1023px) {
    .ut-mobile-header { display: flex; }
    .ut-mobile-footer { display: flex; }
}