:root {
    --primary: #2BF6D1;
    --primary-dim: rgba(43, 246, 209, 0.1);
    --primary-hover: #1de0bd;
    --accent: #3b82f6; 
    --dark: #0f172a;
    --dark-deep: #090e1a;
    --card: #1e293b;
    --card-hover: rgba(30, 41, 59, 0.8);
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    --radius: 12px;
    --glass: rgba(30, 41, 59, 0.7);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

.view-section {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

body {
    background: var(--dark);
    color: var(--text);
    padding-bottom: 50px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

/* NAV - Atualizado para alinhar a Logo à esquerda e Botões à direita */
nav {
    padding: 30px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 40px;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* HERO */
.hero {
    text-align: center;
    margin-bottom: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero h1 {
    font-size: 3.2rem;
    font-weight: 800;
    margin-bottom: 15px;
    letter-spacing: -2px;
    line-height: 1.1;
}

.hero h1 span {
    color: var(--primary);
    text-shadow: 0 0 30px rgba(43, 246, 209, 0.3);
}

.hero p {
    color: var(--text-dim);
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

/* CARD ENCURTADOR */
.card-shortener {
    background: var(--glass);
    backdrop-filter: blur(16px);
    padding: 45px;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
    transition: 0.3s ease;
    max-width: 800px;
    margin: 0 auto;
}

.card-shortener:hover {
    border-color: rgba(43, 246, 209, 0.2);
}

.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.optional {
    color: #64748b;
    text-transform: none;
    font-weight: 400;
}

.input-wrapper,
.subdomain-box,
.path-box {
    background: #0f172a;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    transition: 0.3s;
}

.input-wrapper:focus-within,
.subdomain-box:focus-within,
.path-box:focus-within {
    border-color: var(--accent);
}

input {
    background: transparent;
    border: none;
    padding: 16px;
    color: white;
    font-size: 1rem;
    width: 100%;
    outline: none;
}

.input-wrapper i {
    color: #475569;
}

.host-display,
.prefix {
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
}

.refresh-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 10px;
    transition: 0.3s;
}

.refresh-btn:hover {
    transform: rotate(180deg);
}

.btn-primary {
    width: 100%;
    padding: 18px;
    background: var(--primary);
    color: var(--dark-deep);
    border: none;
    border-radius: 14px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(43, 246, 209, 0.25);
}

.btn-primary:active {
    transform: translateY(-1px);
}

/* ÁREA DE RESULTADO */
.result-area {
    margin: 30px auto 0 auto;
    max-width: 800px;
    animation: slideUp 0.5s ease;
}

.hidden {
    display: none !important;
}

.result-card {
    background: rgba(4, 68, 158, 0.1);
    border: 2px dashed var(--accent);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
}

.result-display {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

#shortUrl {
    background: #0f172a;
    border: 1px solid var(--accent);
    color: var(--primary);
    font-weight: 700;
    border-radius: 8px;
}

#btnCopy {
    background: var(--primary);
    color: var(--accent);
    border: none;
    padding: 0 25px;
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.3s;
}

#btnCopy:hover {
    background: #1de0bd;
}

/* =========================================
   HOME TABS & SLUG STATUS
   ========================================= */
.home-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 40px;
    position: relative;
    background: rgba(255,255,255,0.03);
    padding: 6px;
    border-radius: 100px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid rgba(255,255,255,0.05);
}

.home-tabs button {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    padding: 10px 25px;
    border-radius: 100px;
    position: relative;
    z-index: 2;
}

.home-tabs button.active {
    color: var(--dark-deep);
    background: var(--primary);
}

.home-tab-content {
    animation: fadeIn 0.4s ease;
}

.slug-status {
    font-size: 0.85rem;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.slug-status i {
    font-size: 1rem;
}

.slug-status.unavailable {
    color: #ef4444;
}

.slug-status.available {
    color: var(--primary);
}

.path-box.invalid {
    border-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.05) !important;
}

/* QR MODE TABS (PILLS) */
.qr-mode-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    padding: 5px;
    border-radius: 12px;
    margin-bottom: 25px;
    gap: 5px;
}

.qr-mode-tabs button {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.qr-mode-tabs button.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.qr-mode-tabs button:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   ESTILOS DO SISTEMA DE CONTAS E MODAIS
   ========================================= */

.auth-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: 0.3s;
}

.btn-text:hover {
    color: var(--primary);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--accent);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
    animation: modalFade 0.4s ease;
}

@keyframes modalFade {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.modal-header h2 {
    color: var(--primary);
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    transition: 0.3s;
}

.close-btn:hover {
    color: #ef4444;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-content input {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: 0.3s;
}

.modal-content input:focus {
    border-color: var(--accent);
}

.modal-links {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.modal-links a {
    color: var(--text);
    text-decoration: none;
    transition: 0.3s;
}

.modal-links a:hover {
    color: var(--primary);
}

.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: var(--dark-deep);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    padding: 40px 25px;
    position: fixed;
    height: 100vh;
    z-index: 1000;
}

.sidebar-nav {
    flex-grow: 1;
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-nav a {
    color: var(--text-dim);
    text-decoration: none;
    padding: 12px 15px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: 0.3s;
}

.sidebar-nav a.active {
    background: var(--accent);
    color: white;
}

.sidebar-nav a:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary);
}

.sidebar-nav a.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.main-content {
    margin-left: 280px;
    flex-grow: 1;
    padding: 60px;
    max-width: 1400px;
    margin-right: auto;
}

/* Analytics Grid */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-top: 40px;
    justify-content: center;
}

.chart-container {
    background: var(--card);
    padding: 25px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.chart-container h3 {
    margin-bottom: 20px;
    font-size: 1rem;
    color: var(--primary);
    text-transform: uppercase;
}

/* MOBILE NAVIGATION */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: var(--dark);
    padding: 0 20px;
    align-items: center;
    justify-content: space-between;
    z-index: 1001;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    backdrop-filter: blur(10px);
}

.mobile-logo {
    display: flex;
    align-items: center;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text);
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.5rem;
    cursor: pointer;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: 0.2s;
}

.menu-toggle:active {
    background: var(--primary-dim);
}

@media (max-width: 900px) {
    .mobile-header {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 2000;
        width: 280px;
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
    }

    .sidebar.open {
        transform: translateX(0);
        display: flex !important;
    }

    .main-content {
        margin-left: 0;
        padding: 100px 20px 40px 20px;
        /* Top padding para o mobile-header */
    }

    /* Overlay ao abrir o menu */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(4px);
        z-index: 1999;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* QR Management Mobile */
    .qr-management-container {
        flex-direction: column;
        gap: 30px;
    }

    .qr-preview-panel {
        width: 100%;
        position: static !important;
    }

    .qr-preview-panel .card {
        position: static !important;
        margin-top: 20px;
    }
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .card-shortener {
        padding: 30px 20px;
        border-radius: 20px;
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 30px 20px;
        width: 95%;
        max-width: 100%;
        margin: 0 10px;
    }

    .actions-flex {
        justify-content: flex-start;
        margin-top: 10px;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2.1rem;
    }

    .main-content {
        padding: 90px 12px 40px 12px;
    }

    .home-tabs button {
        padding: 12px 10px;
        font-size: 0.85rem;
    }

    .qr-mode-tabs button {
        font-size: 0.8rem;
        padding: 10px;
    }

    .btn-primary {
        padding: 15px;
        font-size: 0.9rem;
    }
    
    .sidebar {
        width: 85%;
    }
}

/* =========================================
   TABELA "MEUS LINKS" (Design Profissional)
   ========================================= */
.table-container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    overflow-x: auto;
    background: var(--card);
    /* #1e293b */
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.links-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    min-width: 750px;
}

.links-table th {
    padding: 18px 20px;
    color: #94a3b8;
    /* Cinza suave */
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.15);
}

.links-table td {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: #e2e8f0;
    vertical-align: middle;
}

.links-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
    /* Efeito sutil ao passar o mouse na linha */
}

/* Tipografia interna da tabela */
.link-primary {
    color: white;
    font-weight: 600;
    text-decoration: none;
    font-size: 1.05rem;
    transition: 0.2s;
}

.link-primary:hover {
    color: var(--primary);
}

.link-subtext {
    color: #64748b;
    font-size: 0.85rem;
    margin-top: 6px;
    display: block;
}

.link-url-truncate {
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    color: #94a3b8;
}

@media (max-width: 600px) {
    .link-url-truncate {
        max-width: 140px;
    }
    
    .badge-clicks {
        padding: 4px 10px;
        font-size: 0.8rem;
    }
    
    .actions-flex .btn-action {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
}


.badge-clicks {
    background: rgba(43, 246, 209, 0.1);
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 0.95rem;
}

/* Botões de Ação Modernos (Translúcidos) */
.actions-flex {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-action {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s ease;
    font-size: 1.1rem;
}

.btn-copy {
    background: rgba(43, 246, 209, 0.1);
    color: var(--primary);
}

.btn-copy:hover {
    background: var(--primary);
    color: var(--dark);
    transform: translateY(-2px);
}

.btn-pause {
    background: rgba(234, 179, 8, 0.1);
    color: #eab308;
}

.btn-pause:hover {
    background: #eab308;
    color: #fff;
    transform: translateY(-2px);
}

.btn-play {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.btn-play:hover {
    background: #22c55e;
    color: #fff;
    transform: translateY(-2px);
}

.btn-edit {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.btn-edit:hover {
    background: #3b82f6;
    color: #fff;
    transform: translateY(-2px);
}

.btn-delete {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.btn-delete:hover {
    background: #ef4444;
    color: #fff;
    transform: translateY(-2px);
}

/* --- QR MANAGEMENT REFINED --- */
.qr-management-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: start;
    justify-content: center;
}

.qr-config-panel {
    flex: 1;
    min-width: 320px;
    max-width: 650px; /* Limita a largura para não ficar gigante */
}

.qr-preview-panel {
    width: 350px;
}

@media (max-width: 1000px) {
    .qr-preview-panel { width: 100%; }
    .qr-config-panel { max-width: 100%; }
}

.control-group-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.qr-config-panel .card {
    padding: 30px;
    border: 1px solid rgba(255,255,255,0.05);
}

.qr-config-panel select, .qr-config-panel input[type="text"] {
    width: 100%;
    padding: 12px;
    background: #0f172a;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: white;
    outline: none;
    font-size: 0.95rem;
}

.qr-config-panel input[type="color"] {
    width: 100%;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: none;
    padding: 2px;
}

.qr-preview-panel .card {
    background: rgba(4, 68, 158, 0.05);
    border: 1px solid rgba(43, 246, 209, 0.2);
    position: sticky;
    top: 20px;
}

.download-options {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#qrPreviewCanvas {
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: inline-block;
}

#qrPreviewCanvas canvas {
    max-width: 100%;
    height: auto !important;
}