/* Global Variables */
:root {
    --primary-color: #1a1a1a;
    --primary-hover: #0d0d0d;
    --text-color: #1a1a1a;
    --text-light: #4a4a4a;
    --bg-light: #f8f9fa;
    --bg-dark: #1e1e1e;
    --accent-color: #dc3545;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius: 0.75rem;
}

/* Global Font and Typography */
body, html {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(180deg, var(--bg-light), #e9ecef);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh; /* Ensure full viewport height */
    display: flex;
    flex-direction: column;
}

/* Dark Mode Support */
.io-black-mode {
    --text-color: #e0e0e0;
    --text-light: #a0a0a0;
    --bg-light: var(--bg-dark);
    background: linear-gradient(180deg, var(--bg-dark), #2a2a2a);
}

/* Main Content Container */
.page-container {
    flex: 1 0 auto; /* Allow content to grow and fill space */
    display: flex;
    background: inherit; /* Ensure container inherits body gradient */
}

/* Sidebar Navigation */
.sidebar-popup.sidebar-menu-inner > div > ul > li.sidebar-item > ul {
    position: absolute;
    top: 0;
    left: 1rem;
    min-width: 10rem;
    background: var(--bg-light);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    padding: 0.5rem 0;
    transition: var(--transition);
}

.sidebar-popup.sidebar-menu-inner ul li {
    min-width: 10rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-popup.sidebar-menu-inner ul li:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--primary-color);
}

.io-black-mode .sidebar-popup.sidebar-menu-inner ul li {
    color: var(--text-light);
}

.io-black-mode .sidebar-popup.sidebar-menu-inner ul li:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Custom Scrollbar */
.sidebar-menu.flex-fill::-webkit-scrollbar {
    width: 0.375rem;
}

.sidebar-menu.flex-fill::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: 0.25rem;
}

.sidebar-menu.flex-fill::-webkit-scrollbar-track {
    background: transparent;
}

/* Search Bar */
#search button i {
    color: var(--text-light);
    font-size: 1.125rem;
    transition: var(--transition);
}

#search button:hover i {
    color: var(--accent-color);
}

#search button:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Header Navigation */
.big-header-banner .page-header {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.4), transparent);
    box-shadow: var(--shadow-sm);
    padding: 1rem 2rem;
    transition: var(--transition);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.big-header-banner:not(.header-bg) .page-header .navbar-nav > li > a,
.big-header-banner:not(.header-bg) .navbar-menu a:not(.dropdown-item) {
    color: #ffffff;
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
    transition: var(--transition);
}

.big-header-banner:not(.header-bg) .page-header .navbar-nav > li > a:hover,
.big-header-banner:not(.header-bg) .navbar-menu a:not(.dropdown-item):hover {
    color: var(--accent-color);
    background: rgba(255, 255, 255, 0.1);
}

.big-header-banner:not(.header-bg) .header-mini-btn path {
    stroke: #ffffff;
    transition: var(--transition);
}

.big-header-banner:not(.header-bg) .header-mini-btn label:hover path {
    stroke: var(--accent-color);
}

/* Search Input */
.header-big #search-text {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 1.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.header-big #search-text:focus {
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.2);
    background: #ffffff;
}

.io-black-mode .header-big #search-text {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.io-black-mode .header-big #search-text:focus {
    background: rgba(255, 255, 255, 0.2);
}

/* Search Hot Words */
.search-hot-text {
    position: absolute;
    z-index: 1000;
    width: 100%;
    background: var(--bg-light);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.search-hot-text ul {
    margin: 0;
    padding: 0.5rem 0;
}

.search-hot-text ul li {
    line-height: 2rem;
    font-size: 0.875rem;
    padding: 0.5rem 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
}

.search-hot-text ul li:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--primary-color);
}

.io-black-mode .search-hot-text {
    background: var(--bg-dark);
}

.io-black-mode .search-hot-text ul li {
    color: var(--text-light);
}

.io-black-mode .search-hot-text ul li:hover {
    background: rgba(255, 255, 255, 0.2);
}

.search-hot-text ul li.current {
    background: rgba(0, 0, 0, 0.15);
    color: var(--primary-color);
}

.io-black-mode .search-hot-text ul li.current {
    background: rgba(255, 255, 255, 0.3);
}

.search-hot-text ul li span {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    font-size: 0.75rem;
    line-height: 1.25rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.1);
    margin-right: 0.5rem;
    border-radius: 50%;
    color: var(--text-light);
}

.io-black-mode .search-hot-text ul li span {
    background: rgba(255, 255, 255, 0.2);
}

/* URL Cards (Enhanced Visuals) */
.url-card .url-body {
    background: var(--bg-light);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
}

.url-card .url-body:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.url-card .url-img > img {
    border-radius: 0.75rem;
    width: 48px;
    height: 48px;
    object-fit: cover;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.url-card .url-img > img:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-sm);
}

.url-card .url-info .text-sm {
    font-weight: 600;
    color: var(--primary-color);
}

.url-card .url-info p {
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text-light);
}

.io-black-mode .url-card .url-body {
    background: var(--bg-dark);
}

.io-black-mode .url-card .url-info .text-sm {
    color: var(--text-color);
}

.io-black-mode .url-card .url-info p {
    color: var(--text-light);
}

/* Footer (Seamless Background and Enhanced Visuals) */
.main-footer {
    background: inherit; /* Inherit body gradient for seamless transition */
    padding: 2rem;
    font-size: 0.875rem;
    color: var(--text-light);
    text-align: center;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
    flex-shrink: 0; /* Prevent footer from shrinking */
    width: 100%;
}

.io-black-mode .main-footer {
    background: inherit; /* Inherit dark mode gradient */
    box-shadow: 0 -2px 8px rgba(255, 255, 255, 0.05);
}

.main-footer .footer-text {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
}

.main-footer .footer-text a {
    color: var(--accent-color);
    font-weight: 500;
}

.main-footer .footer-text a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

#footer-tools .btn {
    background: var(--bg-light);
    color: var(--text-light);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

#footer-tools .btn:hover {
    background: var(--accent-color);
    color: #ffffff;
    transform: scale(1.1);
}

.io-black-mode #footer-tools .btn {
    background: rgba(255, 255, 255, 0.15);
}

.io-black-mode #footer-tools .btn:hover {
    background: var(--accent-color);
}

/* Global Links */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-color);
}

a:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    body, html {
        font-size: 0.95rem;
    }

    .sidebar-popup.sidebar-menu-inner > div > ul > li.sidebar-item > ul {
        min-width: 8rem;
    }

    .big-header-banner .page-header {
        padding: 0.75rem 1rem;
    }

    .main-footer {
        padding: 1.5rem 1rem;
    }

    .url-card .url-img > img {
        width: 40px;
        height: 40px;
    }

    .url-card .url-info p {
        font-size: 0.8rem;
    }
}

/* Additional Visual Enhancements */
h4.text-gray {
    font-weight: 600;
    color: var(--primary-color);
    position: relative;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

h4.text-gray::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 2px;
    background: var(--accent-color);
    border-radius: 1px;
}

.io-black-mode h4.text-gray {
    color: var(--text-color);
}

.friendlink.card {
    background: var(--bg-light);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.friendlink.card:hover {
    box-shadow: var(--shadow-md);
}

.io-black-mode .friendlink.card {
    background: var(--bg-dark);
}