/* Shared styles for the login system */
:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --input-bg: #2c2c2c;
    --input-border: #333;
    --primary-color: #bb86fc;
    --primary-hover: #9955d4;
    --error-color: #cf6679;
    --toast-bg: #333;
    --toast-text: #fff;
}

body.light-mode {
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-color: #333333;
    --input-bg: #f9f9f9;
    --input-border: #ddd;
    --primary-color: #6200ee;
    --primary-hover: #3700b3;
    --error-color: #b00020;
    --toast-bg: #fff;
    --toast-text: #333;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh; /* Permite crescer além da tela */
    margin: 0;
    transition: background-color 0.3s, color 0.3s;
    overflow-y: auto; /* Garante scroll */
}

.container {
    width: 100%;
    /* max-width: 400px;  <-- Removido para permitir expansão */
    padding: 20px;
    position: relative;
    box-sizing: border-box; /* Garante que padding não estoure a largura */
}

.form-box {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    width: 100%;
    max-width: 400px;
    margin: 20px auto; /* Centraliza */
    text-align: center;
    transition: background-color 0.3s, box-shadow 0.3s;
    position: relative;
    animation: fadeIn 0.5s ease-out;
}

/* Telas mais largas */
.form-box.wide-content {
    max-width: 800px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.logo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.2));
}

h2 {
    margin-bottom: 20px;
    color: var(--text-color);
    font-weight: 600;
}

.input-wrapper {
    position: relative;
    width: 100%;
    margin: 10px 0;
}

input {
    width: 100%;
    padding: 14px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 6px;
    color: var(--text-color);
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.3s, background-color 0.3s;
}

.input-wrapper input {
    margin: 0;
    padding-right: 40px;
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    padding: 0;
    margin: 0;
    width: auto;
    display: flex;
    align-items: center;
    opacity: 0.6;
}

.toggle-password:hover {
    opacity: 1;
}

button.primary-btn {
    width: 100%;
    padding: 14px;
    margin-top: 20px;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
}

button.primary-btn:hover {
    background-color: var(--primary-hover);
}

button.primary-btn:active {
    transform: scale(0.98);
}

.links {
    margin-top: 25px;
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s;
}

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

.hidden {
    display: none !important;
}

p {
    color: var(--text-color);
    opacity: 0.8;
    font-size: 0.95rem;
    margin-bottom: 20px;
}

/* Toast Notification */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: var(--toast-bg);
    color: var(--toast-text);
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 250px;
    animation: slideIn 0.3s ease-out;
    display: flex;
    align-items: center;
    border-left: 4px solid #4CAF50;
}

.toast.error {
    border-left-color: var(--error-color);
}

body.cartoon-ui #toast-container .toast {
    background: linear-gradient(145deg, #2f2f2f, #242424);
    color: #fff8ea;
    border: 2px solid #101010;
    border-left: 6px solid #7fd88b;
    border-radius: 12px;
    box-shadow: 0 6px 0 #101010, 0 12px 22px rgba(0, 0, 0, 0.35);
    font-weight: 800;
    letter-spacing: 0.2px;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.25);
}

body.cartoon-ui #toast-container .toast.error {
    border-left-color: #ff7d7d;
}

body.cartoon-ui #toast-container .toast.warning {
    border-left-color: #ffd166;
}

body.cartoon-ui #toast-container .toast.info {
    border-left-color: #8ecbff;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateY(-10px); }
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--card-bg);
    border: 1px solid var(--input-border);
    color: var(--text-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 9999;
    transition: all 0.3s;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100%;
    background: linear-gradient(180deg, #171515 0%, #101010 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    z-index: 1000;
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 8px 0 28px rgba(0,0,0,0.45);
    backdrop-filter: blur(4px);
}

.sidebar.hidden {
    transform: translateX(-100%);
    display: flex !important; /* Override generic hidden for sidebar animation */
}

.sidebar-header {
    padding: 18px 18px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background:
        radial-gradient(circle at 14% 28%, rgba(255, 255, 255, 0.12), transparent 44%),
        linear-gradient(120deg, rgba(255, 255, 255, 0.04), transparent 52%);
}

.sidebar-header h3 {
    margin: 0;
    color: #fff6df;
    font-size: 1.05rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 800;
}

.close-sidebar-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #f6ead0;
    font-size: 1.3rem;
    line-height: 1;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    cursor: pointer;
    display: none; /* Only show on mobile */
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.close-sidebar-btn:hover {
    transform: translateY(-1px) scale(1.03);
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.sidebar-nav {
    list-style: none;
    padding: 14px 10px 16px;
    margin: 0;
    overflow-y: auto;
}

.sidebar-nav li {
    margin-bottom: 6px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    color: rgba(255, 245, 225, 0.84);
    text-decoration: none;
    border-radius: 13px;
    border: 1px solid transparent;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    font-weight: 700;
    font-size: 0.94rem;
    letter-spacing: 0.01em;
}

.sidebar-nav a svg {
    width: 18px;
    height: 18px;
    opacity: 0.9;
    flex-shrink: 0;
    color: #ffeec6;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.4));
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.sidebar-nav a:hover {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.04));
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: translateX(3px);
}

.sidebar-nav a:hover svg {
    opacity: 1;
    transform: scale(1.06);
}

.sidebar-nav a:focus-visible {
    outline: 2px solid #ffd789;
    outline-offset: 1px;
}

.sidebar-profile-section {
    margin-top: auto;
    padding: 14px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01)),
        rgba(0, 0, 0, 0.26);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-avatar-wrap {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.09);
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.sidebar-avatar-wrap svg {
    color: rgba(255, 255, 255, 0.85);
}

.sidebar-user-meta {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

#sidebar-user-name {
    font-size: 0.84rem;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sidebar-user-real-email {
    font-size: 0.70rem;
    color: rgba(255, 245, 225, 0.74);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 2px 0 4px;
}

.sidebar-user-status {
    font-size: 0.72rem;
    color: #adffcf;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
}

.sidebar-user-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #52d98c;
    box-shadow: 0 0 0 4px rgba(82, 217, 140, 0.18);
}

.sidebar-logout-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: rgba(255, 245, 225, 0.82);
    cursor: pointer;
    padding: 8px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
}

.sidebar-logout-btn:hover {
    background: rgba(255, 99, 99, 0.15);
    border-color: rgba(255, 99, 99, 0.35);
    color: #ff8f8f;
    transform: translateY(-1px);
}

.hamburger-btn {
    position: fixed;
    top: 18px;
    left: 18px;
    background: linear-gradient(145deg, #211f1f, #141313);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff4d5;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    cursor: pointer;
    z-index: 999;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 8px 18px rgba(0, 0, 0, 0.38),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.hamburger-btn:hover {
    transform: translateY(-1px) scale(1.03);
    background: linear-gradient(145deg, #282424, #161414);
    box-shadow:
        0 10px 20px rgba(0, 0, 0, 0.42),
        inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .sidebar {
        width: min(86vw, 320px);
        max-width: 300px;
    }
    .close-sidebar-btn {
        display: block;
    }
    .hamburger-btn {
        top: 14px;
        left: 14px;
        width: 42px;
        height: 42px;
    }
}

/* Plans Grid */
#plans-main-title {
    margin: 0 0 14px;
    color: #fff7e2;
    text-align: center;
    font-size: 1.7rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

#plans-subtitle {
    margin: 6px 0 14px;
    color: #ffeec4;
    text-align: center;
    font-size: 0.95rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    font-weight: 800;
}

.current-plan-info-card {
    margin-bottom: 20px;
    padding: 14px 14px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    background:
        radial-gradient(circle at 85% 12%, rgba(255, 224, 114, 0.18), transparent 42%),
        linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.current-plan-info-card p {
    margin: 8px 0;
    color: #f7f2e8;
    font-size: 0.92rem;
    font-weight: 600;
}

.current-plan-info-card strong {
    color: #fff;
}

.plan-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid transparent;
}

.plan-status-pill.active {
    color: #c8ffe0;
    background: rgba(82, 217, 140, 0.18);
    border-color: rgba(82, 217, 140, 0.35);
}

.plan-status-pill.expired {
    color: #ffd1d1;
    background: rgba(255, 107, 107, 0.18);
    border-color: rgba(255, 107, 107, 0.35);
}

.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.plan-card {
    background:
        radial-gradient(circle at 85% 8%, rgba(255, 255, 255, 0.14), transparent 36%),
        linear-gradient(160deg, rgba(34, 34, 34, 0.98), rgba(19, 19, 19, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 18px;
    padding: 0;
    cursor: pointer;
    transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
}

.plan-card.plan-card-stagger-in {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
    animation: planCardStaggerIn 0.52s cubic-bezier(0.2, 0.9, 0.24, 1) forwards;
    animation-delay: calc(var(--plan-stagger-index, 0) * 70ms);
}

@keyframes planCardStaggerIn {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.plan-card:hover {
    border-color: rgba(255, 236, 198, 0.42);
    transform: translateY(-4px) rotate(-0.2deg);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.36);
}

.plan-card.selected {
    border-color: rgba(255, 211, 128, 0.62);
    box-shadow: 0 0 0 2px rgba(255, 211, 128, 0.22), 0 14px 30px rgba(0, 0, 0, 0.34);
}

.plan-days {
    font-size: 1.35rem;
    font-weight: 800;
    color: #fff8e8;
    margin-bottom: 5px;
}

.plan-price {
    color: #ffd287;
    font-weight: 900;
    font-size: 2rem;
}

.plan-price span {
    color: rgba(255, 238, 200, 0.74);
    font-size: 0.84rem;
    font-weight: 700;
}

.plan-header {
    padding: 18px 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
    gap: 10px;
}

.plan-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    margin-bottom: 4px;
}

.plan-icon svg {
    width: 28px;
    height: 28px;
}

.plan-title {
    font-size: 1.1rem;
    letter-spacing: 0.04em;
}

.plan-body {
    padding: 16px 14px 14px;
    gap: 11px;
}

.plan-features {
    font-size: 0.86rem;
    color: #f2eadf;
    gap: 9px;
    padding: 6px 0;
}

.plan-features span {
    width: 19px;
    height: 19px;
    font-size: 0.92rem;
}

.netflix-btn {
    border-radius: 12px;
    font-size: 0.9rem;
    letter-spacing: 0.07em;
    font-weight: 800;
    padding: 13px 10px;
}

.plan-generating-loading-panel {
    text-align: center;
    padding: 34px 18px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
    margin-top: 8px;
}

.plan-generating-spinner {
    border: 4px solid rgba(255, 255, 255, 0.12);
    border-top: 4px solid #ffd287;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 18px;
}

#plan-generating-text {
    color: #fff5dc;
    font-weight: 800;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pix-payment-area {
    margin-top: 22px;
    text-align: center;
    border-top: 1px dashed rgba(255, 255, 255, 0.28);
    padding-top: 20px;
}

.pix-payment-area h3 {
    color: #fff3d4;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.pix-payment-area p {
    color: rgba(255, 247, 227, 0.84);
}

#pix-qr-img img {
    max-width: 250px;
    border-radius: 14px;
    border: 2px solid rgba(255, 222, 151, 0.75);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.32);
}

.pix-copy-paste-field {
    width: 100%;
    margin-top: 10px;
    background: rgba(10, 10, 10, 0.5);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    padding: 10px;
}

.pix-copy-btn {
    margin-top: 8px;
}

.payment-status-text {
    margin-top: 12px;
    font-weight: 800;
    color: #ffcf7e;
    letter-spacing: 0.02em;
}

.pix-cancel-btn {
    margin-top: 10px;
    background-color: #6d6d6d;
}

.plans-back-btn {
    margin-top: 20px;
}

@media (prefers-reduced-motion: reduce) {
    .plan-card.plan-card-stagger-in {
        opacity: 1;
        transform: none;
        animation: none;
    }
}

/* Payment List */
.payment-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: background 0.2s;
}

.payment-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.payment-icon-wrapper {
    width: 40px;
    height: 40px;
    background: rgba(76, 175, 80, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4CAF50;
}

.payment-details {
    flex: 1;
}

.payment-plan-name {
    color: #fff;
    font-weight: 600;
    margin-bottom: 4px;
}

.payment-date {
    color: #888;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
}

.payment-amount {
    font-weight: bold;
    color: #fff;
    font-size: 1.1rem;
}

.payment-status-badge {
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 4px;
    border: 1px solid rgba(76, 175, 80, 0.2);
}

/* Group List Styling - Enhanced */
#groups-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
    padding: 5px;
}

.group-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #333;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.group-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #555;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.group-item.selected {
    background: rgba(229, 9, 20, 0.15);
    border-color: #e50914;
}

.group-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #e50914;
    cursor: pointer;
    flex-shrink: 0;
}

.group-avatar {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #333, #444);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
    border: 2px solid #555;
    text-transform: uppercase;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.group-info {
    flex: 1;
    min-width: 0; /* for text-overflow */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.group-name {
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
    display: block;
}

.group-meta {
    color: #888;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
}
