/* Reset & Base */
* { box-sizing: border-box; }
body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background-color: #f1f1f1; color: #333; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; padding: 0; margin: 0; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 0 15px; }
#wrapper { display: flex; flex-direction: column; min-height: 100vh; }
#content { flex: 1; padding: 20px 0; }

/* Header */
#header { background-color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.1); padding: 15px 0; }
#header .container { display: flex; align-items: center; justify-content: space-between; }
.logo_wrapper a { font-weight: bold; font-size: 24px; color: #0088cc; }
.menu { display: flex; gap: 20px; }
.menu a { font-size: 14px; font-weight: 500; color: #555; }
.menu a:hover { color: #0088cc; }
.menu-btn { display: none; }

/* Sub-Header & Search */
#sub-header { background-color: #0088cc; padding: 30px 0; color: #fff; }
.form-wrapper { max-width: 600px; margin: 0 auto; }
.form form { display: flex; background: #fff; border-radius: 4px; overflow: hidden; padding: 5px; }
.form input { flex: 1; border: none; padding: 10px 15px; font-size: 16px; outline: none; }
.form button { background: none; border: none; padding: 0 15px; cursor: pointer; color: #0088cc; }

/* Channels Grid */
.tg-channels { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-top: 20px; }
.tg-channel-wrapper { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 4px rgba(0,0,0,0.05); transition: transform 0.2s; }
.tg-channel-wrapper:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); }

.tg-channel { padding: 20px; position: relative; }
.tg-channel-options { position: absolute; top: 10px; right: 10px; }
.tg-options-public { background: #e6f4f9; color: #0088cc; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: bold; }

.tg-channel-img { width: 80px; height: 80px; margin: 0 auto 15px; border-radius: 50%; overflow: hidden; background: #eee; }
.tg-channel-img img { width: 100%; height: 100%; object-fit: cover; }

.tg-channel-link { text-align: center; margin-bottom: 10px; }
.tg-channel-link a { font-weight: bold; font-size: 18px; color: #333; }

.tg-channel-user { text-align: center; font-size: 13px; color: #777; margin-bottom: 10px; }
.tg-user-change.is-plus { color: #28a745; margin-left: 5px; }

.tg-channel-description { font-size: 14px; color: #666; text-align: center; margin-bottom: 20px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.tg-channel-more { text-align: center; }
.tg-channel-more .app { display: inline-block; background: #0088cc; color: #fff; padding: 8px 25px; border-radius: 20px; font-weight: 500; transition: background 0.2s; }
.tg-channel-more .app:hover { background: #0077b5; }

/* Pagination */
.tg-pager-wrapper { margin: 40px 0; text-align: center; }
.tg-pager { display: inline-flex; gap: 5px; }
.tg-pager-li { display: inline-block; }
.tg-pager-li a, .tg-pager-li.is-current { display: block; padding: 8px 12px; border-radius: 4px; border: 1px solid #ddd; background: #fff; color: #333; font-size: 14px; }
.tg-pager-li.is-current { background: #0088cc; color: #fff; border-color: #0088cc; }
.tg-pager-li a:hover { background: #f5f5f5; }

/* Footer */
#footer { background: #fff; border-top: 1px solid #eee; padding: 20px 0; text-align: center; font-size: 14px; color: #999; margin-top: auto; }

/* Responsive */
@media (max-width: 768px) {
    #header .container { flex-direction: column; gap: 10px; padding: 10px; }
    .menu { flex-wrap: wrap; justify-content: center; gap: 10px; }
    .menu a { font-size: 13px; }
    #sub-header { padding: 20px 0; }
    .form-wrapper { padding: 0 15px; }
    .tg-channels { grid-template-columns: 1fr; padding: 0 10px; }
    .logo_wrapper a { font-size: 20px; }
}

@media (max-width: 480px) {
    .tg-channel-img { width: 60px; height: 60px; }
    .tg-channel-link a { font-size: 16px; }
    .tg-pager-li a, .tg-pager-li.is-current { padding: 6px 10px; font-size: 12px; }
    h1 { font-size: 22px; text-align: center; }
}
