/**
 * WinBolo.net Components Styles
 * Header, Footer, Sidebar, Widgets, Login Panel
 */

/* ============================================
   Header
   ============================================ */
.header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    color: white;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.header-content .theme-toggle {
    flex-shrink: 0;
}

/* ============================================
   Logo
   ============================================ */
.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo img,
.logo-image {
    height: auto;
    width: auto;
    max-width: 100%;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
}

/* ============================================
   Menu Toggle (Mobile)
   ============================================ */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* ============================================
   Login Panel
   ============================================ */
.login-panel {
    background: var(--bg-white);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: var(--shadow);
    min-width: 280px;
}

.login-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--accent-orange);
    color: var(--border-color);
    padding: 0.5rem 1rem;
    font-weight: 700;
    font-size: 0.9rem;
    margin: -1rem -1rem 1rem -1rem;
    border-radius: 8px 8px 0 0;
}

.login-header .theme-toggle {
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.15);
    margin-left: 0;
}

.login-header .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.2);
}

.login-header .theme-toggle-icon {
    width: 14px;
    height: 14px;
    color: var(--border-color);
}

.login-form {
    display: grid;
    gap: 0.75rem;
}

.signed-in-form {
    display: grid;
    gap: 0;
}

.form-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.welcome-text {
    color: var(--text-dark);
}

.form-row label {
    font-size: 0.85rem;
    min-width: 100px;
    color: var(--text-muted);
}

.form-row input[type="text"],
.form-row input[type="password"] {
    flex: 1;
    min-width: 120px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.form-row input[type="submit"] {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.form-row input[type="submit"]:hover {
    background: var(--primary-blue-dark);
}

.login-options {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.login-options a {
    color: var(--primary-blue);
    text-decoration: none;
}

.login-options a:hover {
    text-decoration: underline;
}

/* ============================================
   Navigation Sidebar
   ============================================ */
.nav-sidebar {
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.nav-header {
    background: var(--accent-orange);
    color: var(--border-color);
    padding: 0.75rem 1rem;
    font-weight: 700;
    font-size: 0.9rem;
}

.nav-section {
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

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

.nav-subheader {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--accent-orange);
    border-bottom: 2px dashed var(--accent-orange);
    padding-bottom: 0.25rem;
    margin-bottom: 0.75rem;
}

.nav-links {
    list-style: none;
}

.nav-links li {
    margin-bottom: 0.5rem;
}

.nav-links a {
    color: var(--primary-blue);
    text-decoration: none;
    font-size: 0.9rem;
    display: block;
    padding: 0.25rem 0;
}

.nav-links a:hover {
    text-decoration: underline;
    color: var(--primary-blue-dark);
}

.search-form {
    margin-top: 0.75rem;
}

.search-form input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.donate-section {
    text-align: center;
    padding: 1rem;
}

/* ============================================
   Main Container & Layout
   ============================================ */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 1.5rem;
}

.content-area {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ============================================
   News Container
   ============================================ */
.news-container {
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.news-header {
    background: var(--accent-orange);
    color: var(--border-color);
    padding: 0.75rem 1rem;
    font-weight: 700;
    font-size: 1rem;
}

.news-content {
    padding: 1.5rem;
}

.news-item {
    border-bottom: 1px solid #eee;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

.news-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.news-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.news-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: right;
    margin-bottom: 1rem;
}

.news-meta a {
    color: var(--primary-blue);
    text-decoration: none;
}

.news-body {
    font-size: 0.95rem;
    line-height: 1.7;
}

.news-body a {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 600;
}

.news-body a:hover {
    text-decoration: underline;
}

.comments-link {
    display: block;
    text-align: right;
    margin-top: 1rem;
    font-size: 0.9rem;
    font-weight: 600;
}

/* ============================================
   Widgets
   ============================================ */
.widget {
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.widget-header {
    background: var(--accent-orange);
    color: var(--border-color);
    padding: 0.75rem 1rem;
    font-weight: 700;
    font-size: 0.9rem;
}

.widget-content {
    padding: 1rem;
}

/* ============================================
   Recent Posts Widget
   ============================================ */
.recent-posts-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.recent-post-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #eee;
}

.recent-post-item:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.recent-post-title {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    line-height: 1.4;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.recent-post-title:hover {
    text-decoration: underline;
    color: var(--primary-blue-dark);
}

.recent-post-author {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.recent-post-author a {
    color: var(--primary-blue);
    text-decoration: none;
}

.recent-post-author a:hover {
    text-decoration: underline;
}

/* ============================================
   Footer
   ============================================ */
.footer {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    margin-top: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.footer-brand {
    font-weight: 700;
}

.footer-separator {
    opacity: 0.4;
}

.footer-link {
    color: var(--accent-orange);
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.2s;
}

.footer-link:hover {
    text-decoration: underline;
    opacity: 0.9;
}

.generation-time {
    opacity: 0.75;
    font-size: 0.8rem;
}

/* ============================================
   Page Views Footer
   ============================================ */
.page-views-footer {
    text-align: center;
    padding: 1rem;
    background: var(--bg-gray);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.page-views-count {
    font-weight: 700;
    color: var(--primary-blue);
    font-size: 1.1rem;
    margin: 0 0.25rem;
}

/* ============================================
   Dark Theme Overrides
   ============================================ */
[data-theme="dark"] .login-header,
[data-theme="dark"] .nav-header,
[data-theme="dark"] .news-header,
[data-theme="dark"] .widget-header {
    color: #ffffff;
}

[data-theme="dark"] .nav-links a,
[data-theme="dark"] .news-meta a,
[data-theme="dark"] .news-body a,
[data-theme="dark"] .recent-post-title,
[data-theme="dark"] .recent-post-author a,
[data-theme="dark"] .login-options a {
    color: #4d9fff;
}

[data-theme="dark"] .nav-links a:hover,
[data-theme="dark"] .recent-post-title:hover,
[data-theme="dark"] .login-options a:hover {
    color: #7cb8ff;
}

/* ============================================
   Autocomplete Component
   ============================================ */
.autocomplete-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    min-width: 100%;
    max-height: 250px;
    overflow-y: auto;
    background: var(--bg-white);
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    margin-top: 2px;
    font-size: 0.95rem;
}

.autocomplete-dropdown.visible {
    display: block;
}

.autocomplete-item {
    padding: 0.6rem 1rem;
    cursor: pointer;
    color: var(--text-dark);
    border-bottom: 1px solid #eee;
    transition: background-color 0.15s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: var(--primary-blue);
    color: white;
}

.autocomplete-item strong {
    color: var(--accent-orange);
    font-weight: 700;
}

.autocomplete-item:hover strong,
.autocomplete-item.selected strong {
    color: #ffd699;
}

.autocomplete-loading,
.autocomplete-empty,
.autocomplete-error {
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

.autocomplete-error {
    color: #dc3545;
    font-style: normal;
}

/* Dark theme autocomplete styles */
[data-theme="dark"] .autocomplete-dropdown {
    background: var(--bg-white);
    border-color: var(--divider-color);
}

[data-theme="dark"] .autocomplete-item {
    color: var(--text-dark);
    border-color: var(--divider-color);
}

[data-theme="dark"] .autocomplete-item:hover,
[data-theme="dark"] .autocomplete-item.selected {
    background: var(--primary-blue);
    color: white;
}

[data-theme="dark"] .autocomplete-loading,
[data-theme="dark"] .autocomplete-empty {
    color: var(--text-muted);
}

[data-theme="dark"] .autocomplete-error {
    color: #ff6b6b;
}