/* =========================================================
 * USER ACCOUNT SYSTEM - Giao diện
 * ======================================================= */

/* ---------- Nút chung ---------- */
.us-btn {
    display: inline-block;
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, opacity .2s;
    text-decoration: none;
    text-align: center;
}
.us-btn-primary {
    background: #e50914;
    color: #fff;
}
.us-btn-primary:hover { background: #f6121d; color: #fff; }
.us-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ---------- Header user area ---------- */
.us-header-user {
    position: relative;
    display: block;
    float: right;
    margin-top: 20px;
    margin-left: 12px;
    height: 40px;
    line-height: 40px;
    white-space: nowrap;
}
.us-header-user .us-login-link,
.us-header-user .us-user-toggle {
    display: inline-block;
    vertical-align: middle;
    line-height: 40px;
    height: 40px;
}
.us-header-user .us-user-toggle:before {
    content: "";
    display: inline-block;
    vertical-align: middle;
    width: 1px;
    height: 22px;
    background: rgba(255,255,255,.2);
    margin-right: 12px;
}
.us-user-toggle:after {
    content: "";
    display: inline-block;
    vertical-align: middle;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    margin-left: 2px;
}
.us-header-user .us-login-link,
.us-header-user .us-user-toggle {
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
}
.us-header-user .us-login-link > *,
.us-header-user .us-user-toggle > * {
    display: inline-block;
    vertical-align: middle;
    margin: 0 4px 0 0;
}
.us-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,.25);
}
.us-user-icon {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid currentColor;
    position: relative;
}
.us-user-icon::before {
    content: "";
    position: absolute;
    top: 3px; left: 50%;
    transform: translateX(-50%);
    width: 7px; height: 7px;
    border-radius: 50%;
    background: currentColor;
}
.us-user-icon::after {
    content: "";
    position: absolute;
    bottom: 1px; left: 50%;
    transform: translateX(-50%);
    width: 13px; height: 7px;
    border-radius: 7px 7px 0 0;
    background: currentColor;
}
.us-user-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.us-user-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: #1b1b1f;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.45);
    list-style: none;
    margin: 8px 0 0;
    padding: 6px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all .18s ease;
    z-index: 9999;
}
.us-header-user.open .us-user-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.us-user-menu li a {
    display: block;
    padding: 9px 16px;
    color: #ddd;
    text-decoration: none;
    font-size: 13px;
}
.us-user-menu li a:hover { background: rgba(255,255,255,.06); color: #fff; }
.us-user-menu .us-divider {
    height: 1px;
    background: rgba(255,255,255,.08);
    margin: 6px 0;
}

/* ---------- Modal Auth ---------- */
.us-auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    padding: 20px;
}
.us-auth-overlay.open { display: flex; }
.us-auth-box {
    width: 100%;
    max-width: 400px;
    background: #1b1b1f;
    border-radius: 12px;
    padding: 30px;
    position: relative;
    box-shadow: 0 16px 50px rgba(0,0,0,.5);
}
.us-auth-close {
    position: absolute;
    top: 12px; right: 16px;
    font-size: 26px;
    line-height: 1;
    color: #888;
    cursor: pointer;
}
.us-auth-close:hover { color: #fff; }
.us-auth-tabs {
    display: flex;
    margin-bottom: 22px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.us-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 12px;
    color: #999;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}
.us-tab.active {
    color: #fff;
    border-bottom-color: #e50914;
}
.us-auth-form { display: none; }
.us-auth-form.active { display: block; }
.us-field { margin-bottom: 14px; }
.us-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #bbb;
}
.us-field label small { color: #777; }
.us-auth-form input[type="text"],
.us-auth-form input[type="email"],
.us-auth-form input[type="password"],
.us-profile-form input[type="text"],
.us-profile-form input[type="email"],
.us-profile-form input[type="password"] {
    width: 100%;
    padding: 11px 13px;
    background: #2a2a30;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    box-sizing: border-box;
}
.us-auth-form input:focus,
.us-profile-form input:focus {
    outline: none;
    border-color: #e50914;
}
.us-remember {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #bbb;
    margin-bottom: 16px;
}
.us-auth-form .us-btn { width: 100%; }
.us-switch {
    text-align: center;
    font-size: 13px;
    color: #999;
    margin: 14px 0 0;
}
.us-switch a { color: #e50914; text-decoration: none; }

/* Thông báo */
.us-auth-msg {
    display: none;
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 14px;
}
.us-auth-msg.us-ok {
    display: block;
    background: rgba(46,160,67,.15);
    color: #3fb950;
    border: 1px solid rgba(46,160,67,.4);
}
.us-auth-msg.us-err {
    display: block;
    background: rgba(229,9,20,.12);
    color: #ff5a5f;
    border: 1px solid rgba(229,9,20,.4);
}

/* ---------- Trang tài khoản ---------- */
.us-account-page {
    display: flex;
    gap: 26px;
    width: 100%;
    margin: 30px 0;
    padding: 0;
    align-items: flex-start;
    box-sizing: border-box;
}
.us-account-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #1b1b1f;
    border-radius: 12px;
    padding: 24px 18px;
}
.us-account-user {
    text-align: center;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    margin-bottom: 14px;
}
.us-avatar-wrap {
    position: relative;
    width: 90px;
    height: 90px;
    margin: 0 auto 12px;
}
.us-avatar-wrap img {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,.15);
}
.us-avatar-wrap.loading { opacity: .5; }
.us-avatar-edit {
    position: absolute;
    bottom: 0; right: 0;
    width: 28px; height: 28px;
    background: #e50914;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid #1b1b1f;
}
.us-cam-icon {
    width: 13px; height: 10px;
    border: 1.5px solid #fff;
    border-radius: 2px;
    position: relative;
}
.us-cam-icon::before {
    content: "";
    position: absolute;
    top: -4px; left: 50%;
    transform: translateX(-50%);
    width: 5px; height: 3px;
    background: #fff;
    border-radius: 2px 2px 0 0;
}
.us-cam-icon::after {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    width: 4px; height: 4px;
    border: 1.5px solid #fff;
    border-radius: 50%;
}
.us-account-name {
    margin: 0 0 4px;
    color: #fff;
    font-size: 17px;
}
.us-account-email {
    font-size: 12px;
    color: #888;
    word-break: break-all;
}
.us-account-nav {
    list-style: none;
    margin: 0;
    padding: 0;
}
.us-account-nav li a {
    display: block;
    padding: 11px 14px;
    color: #ccc;
    text-decoration: none;
    border-radius: 7px;
    font-size: 14px;
    margin-bottom: 3px;
}
.us-account-nav li.active a,
.us-account-nav li a:hover {
    background: rgba(229,9,20,.12);
    color: #fff;
}
.us-nav-logout a { color: #ff6b6b !important; }

.us-account-content {
    flex: 1;
    background: #1b1b1f;
    border-radius: 12px;
    padding: 26px;
    min-height: 400px;
    min-width: 0;
}
.us-tab-title {
    margin: 0 0 22px;
    color: #fff;
    font-size: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.us-profile-form { max-width: 440px; }
.us-profile-form .us-btn { margin-top: 6px; }

/* ---------- Lưới phim ---------- */
.us-movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 18px;
}
.us-movie-item { position: relative; }
.us-movie-thumb {
    display: block;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 2/3;
    background: #2a2a30;
}
.us-movie-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .25s;
}
.us-movie-item:hover .us-movie-thumb img { transform: scale(1.05); }
.us-movie-title {
    display: block;
    margin-top: 8px;
    color: #ddd;
    font-size: 13px;
    text-decoration: none;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.us-movie-title:hover { color: #fff; }
.us-movie-actions {
    margin-top: 6px;
    display: flex;
    gap: 6px;
}
.us-act-btn {
    background: rgba(255,255,255,.08);
    border: none;
    color: #ccc;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
}
.us-act-btn:hover { background: rgba(229,9,20,.7); color: #fff; }
.us-act-btn.active { background: rgba(229,9,20,.85); color: #fff; }

.us-empty {
    color: #888;
    font-size: 14px;
    padding: 30px 0;
    text-align: center;
}

/* ---------- Playlist ---------- */
.us-pl-create-top {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}
.us-pl-create-top input {
    flex: 1;
    padding: 10px 13px;
    background: #2a2a30;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
}
.us-pl-create-top input:focus { outline: none; border-color: #e50914; }
.us-playlist-block {
    margin-bottom: 30px;
    padding-bottom: 22px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.us-playlist-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.us-playlist-head h3 {
    margin: 0;
    color: #fff;
    font-size: 16px;
}
.us-pl-count { color: #888; font-weight: 400; font-size: 13px; }

/* ---------- Popup chọn playlist ---------- */
.us-pl-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100001;
    padding: 20px;
}
.us-pl-popup {
    width: 100%;
    max-width: 360px;
    background: #1b1b1f;
    border-radius: 12px;
    padding: 24px;
    position: relative;
}
.us-pl-popup-close {
    position: absolute;
    top: 10px; right: 14px;
    font-size: 24px;
    color: #888;
    cursor: pointer;
}
.us-pl-popup-close:hover { color: #fff; }
.us-pl-popup h4 {
    margin: 0 0 16px;
    color: #fff;
    font-size: 16px;
}
.us-pl-list {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    max-height: 240px;
    overflow-y: auto;
}
.us-pl-list li { margin-bottom: 8px; }
.us-pl-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ddd;
    font-size: 14px;
    cursor: pointer;
}
.us-pl-empty { color: #888; font-size: 13px; }
.us-pl-inline {
    display: flex;
    gap: 8px;
    border-top: 1px solid rgba(255,255,255,.08);
    padding-top: 14px;
}
.us-pl-inline input {
    flex: 1;
    padding: 9px 12px;
    background: #2a2a30;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
}
.us-pl-inline input:focus { outline: none; border-color: #e50914; }

/* ---------- Nút lưu phim ở trang single ---------- */
.us-action-btns {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
}
.us-action-btns .Button {
    margin-right: 0 !important;
    margin-bottom: 0 !important;
    vertical-align: middle;
}
.us-save-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
.us-save-btn.active { color: #e50914; }

/* ---------- Yêu cầu đăng nhập ---------- */
.us-need-login {
    justify-content: center;
}
.us-login-required {
    text-align: center;
    background: #1b1b1f;
    border-radius: 12px;
    padding: 50px 40px;
    margin: 40px auto;
    max-width: 460px;
}
.us-login-required h2 { color: #fff; margin: 0 0 10px; }
.us-login-required p { color: #999; margin: 0 0 20px; }

/* ---------- Bình luận ---------- */
.us-comments { padding: 16px 0; }
.us-cmt-form {
    display: flex;
    gap: 12px;
    margin-bottom: 22px;
}
.us-cmt-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,.15);
}
.us-cmt-input-wrap { flex: 1; min-width: 0; }
.us-cmt-input {
    width: 100%;
    padding: 11px 13px;
    background: #2a2a30;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    box-sizing: border-box;
    resize: vertical;
    font-family: inherit;
}
.us-cmt-input:focus { outline: none; border-color: #e50914; }
.us-cmt-submit { margin-top: 10px; }
.us-cmt-msg { font-size: 13px; margin-top: 6px; }
.us-cmt-msg.us-err { color: #ff5a5f; }
.us-cmt-msg.us-ok { color: #3fb950; }
.us-cmt-login-note {
    background: #1b1b1f;
    padding: 16px;
    border-radius: 8px;
    color: #bbb;
    font-size: 14px;
    margin-bottom: 18px;
}
.us-cmt-login-note a { color: #e50914; text-decoration: none; }
.us-cmt-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.us-cmt-item {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.us-cmt-body { flex: 1; min-width: 0; }
.us-cmt-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}
.us-cmt-name { color: #fff; font-weight: 600; font-size: 14px; }
.us-cmt-time { color: #888; font-size: 12px; }
.us-cmt-text {
    color: #ddd;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}
.us-cmt-empty {
    color: #888;
    font-size: 14px;
    padding: 20px 0;
    text-align: center;
}

/* ---------- Notification Bell ---------- */
.us-notif-bell {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    cursor: pointer;
    margin-right: 4px;
    width: 34px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    color: rgba(255,255,255,.75);
    transition: color .15s;
}
.us-notif-bell:hover { color: #fff; }
.us-notif-icon {
    display: inline-block;
    vertical-align: middle;
    line-height: 0;
}
.us-notif-icon svg {
    display: inline-block;
    vertical-align: middle;
    width: 18px;
    height: 18px;
}
.us-notif-count {
    position: absolute;
    top: 4px;
    right: 0;
    background: #e50914;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    line-height: 16px;
    text-align: center;
    padding: 0 3px;
}
.us-notif-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 320px;
    background: #1b1b1f;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0,0,0,.5);
    z-index: 99999;
    overflow: hidden;
}
.us-notif-bell.open .us-notif-dropdown { display: block; }
.us-notif-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 340px;
    overflow-y: auto;
}
.us-notif-item {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,.05);
}
.us-notif-item a {
    display: block;
    color: #ccc;
    font-size: 13px;
    text-decoration: none;
    line-height: 1.5;
}
.us-notif-item a:hover { color: #fff; }
.us-notif-item strong { color: #fff; }
.us-notif-unread { background: rgba(229,9,20,.07); }
.us-notif-time {
    display: block;
    font-size: 11px;
    color: #666;
    margin-top: 3px;
}
.us-notif-empty {
    padding: 18px 14px;
    color: #888;
    font-size: 13px;
    text-align: center;
}
.us-notif-footer {
    padding: 10px 14px;
    border-top: 1px solid rgba(255,255,255,.08);
    text-align: right;
}
.us-notif-read-all {
    background: none;
    border: none;
    color: #e50914;
    font-size: 12px;
    cursor: pointer;
}
.us-notif-read-all:hover { text-decoration: underline; }

/* ---------- Reply trong bình luận ---------- */
.us-cmt-reply-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}
.us-cmt-delete-btn {
    background: none;
    border: none;
    color: #555;
    font-size: 13px;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 4px;
    margin-left: auto;
}
.us-cmt-delete-btn:hover { color: #e50914; background: rgba(229,9,20,.1); }
.us-cmt-reply-btn:hover { color: #fff; background: rgba(255,255,255,.08); }
.us-cmt-reply-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(229,9,20,.1);
    border-left: 3px solid #e50914;
    padding: 7px 12px;
    margin-bottom: 8px;
    border-radius: 0 6px 6px 0;
    font-size: 13px;
    color: #ddd;
    width: 100%;
    box-sizing: border-box;
}
.us-cmt-cancel-reply {
    margin-left: auto;
    cursor: pointer;
    color: #888;
    font-size: 15px;
}
.us-cmt-cancel-reply:hover { color: #fff; }
.us-cmt-reply-tag {
    display: inline-block;
    color: #e50914;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 3px;
}
.us-cmt-item.us-cmt-reply {
    margin-left: 52px;
    border-left: 2px solid rgba(229,9,20,.25);
    padding-left: 12px;
    background: rgba(255,255,255,.02);
    border-radius: 0 8px 8px 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .us-account-page { flex-direction: column; }
    .us-account-sidebar { width: 100%; box-sizing: border-box; }
    .us-user-name { display: none; }
}
