/* ============================================
   FBPROTOOLS - Design System Mobile-First
   ============================================ */

/* Reset e variáveis globais */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Cores principais */
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #a5b4fc;
    --secondary-color: #8b5cf6;

    /* Cores de fundo */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-sidebar-hover: #f1f5f9;

    /* Cores de texto */
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    /* Cores de borda */
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;

    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* Medidas */
    --sidebar-width: 280px;
    --sidebar-collapsed: 70px;
    --header-height: 60px;
    --border-radius: 12px;
    --border-radius-sm: 8px;

    /* Transições */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tipografia base */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
}

/* ============================================
   HEADER / CABEÇALHO
   ============================================ */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
    transition: var(--transition);
}

.logo-icon {
    display: flex;
    align-items: center;
    color: var(--primary-color);
}

.logo-text {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.menu-toggle:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-primary);
}

.menu-icon {
    display: flex;
    align-items: center;
}

/* ============================================
   SIDEBAR / MENU LATERAL
   ============================================ */

.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--transition);
    z-index: 900;
    padding: 1rem 0;
}

/* Scrollbar customizada */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

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

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Botão Toggle do Sidebar (Desktop) */
.sidebar-toggle-btn {
    display: none; /* Oculto no mobile */
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: 0 auto 1rem;
    background: var(--bg-sidebar-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.sidebar-toggle-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 769px) {
    .sidebar-toggle-btn {
        display: flex;
    }
}

/* Sidebar colapsada (Desktop) */
.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-toggle-btn {
    margin: 0 auto 1rem;
}

.sidebar.collapsed .category-title-text,
.sidebar.collapsed .menu-link-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar.collapsed .category-items {
    display: none;
}

.sidebar.collapsed .category-arrow {
    display: none;
}

.sidebar.collapsed .category-header {
    justify-content: center;
}

.sidebar.collapsed .category-title {
    justify-content: center;
}

.sidebar.collapsed .menu-link {
    justify-content: center;
    padding: 0.75rem;
}

/* Mobile: sidebar desliza da DIREITA */
@media (max-width: 768px) {
    .sidebar {
        left: auto;
        right: 0;
        border-right: none;
        border-left: 1px solid var(--border-color);
        transform: translateX(100%);
        box-shadow: var(--shadow-xl);
    }

    .sidebar.active {
        transform: translateX(0);
    }
}

/* Categorias do menu */
.menu-category {
    margin-bottom: 0.25rem;
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    border-radius: var(--border-radius-sm);
    margin: 0 0.5rem;
}

.category-header:hover {
    background: var(--bg-sidebar-hover);
}

.category-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.category-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.category-title-text {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    transition: var(--transition);
}

.category-arrow {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    transition: var(--transition);
}

.category-header.expanded .category-arrow {
    transform: rotate(90deg);
}

/* Itens do menu */
.category-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-items.show {
    max-height: 500px;
}

.menu-items {
    list-style: none;
    padding: 0.25rem 0;
}

.menu-item {
    margin: 0.125rem 0.5rem;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    font-size: 0.9375rem;
}

.menu-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: var(--transition);
}

.menu-link:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-primary);
}

.menu-link.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1) 0%, transparent 100%);
    color: var(--primary-color);
    font-weight: 600;
}

.menu-link.active::before {
    transform: scaleY(1);
}

.menu-link.active .menu-link-icon {
    color: var(--primary-color);
}

.menu-link-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.menu-link-text {
    white-space: nowrap;
    transition: var(--transition);
}

/* ============================================
   CONTEÚDO PRINCIPAL
   ============================================ */

.main-container {
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
    display: flex;
}

.content {
    flex: 1;
    padding: 2rem 1rem;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    max-width: 100%;
}

.sidebar.collapsed ~ .main-container .content {
    margin-left: var(--sidebar-collapsed);
}

@media (max-width: 768px) {
    .content {
        margin-left: 0;
        padding: 1.5rem 1rem;
    }
}

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
}

/* Títulos de página */
.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin-bottom: 2rem;
}

@media (max-width: 640px) {
    .page-title {
        font-size: 1.5rem;
    }

    .page-subtitle {
        font-size: 1rem;
    }
}

/* ============================================
   CARDS E FERRAMENTAS
   ============================================ */

.tool-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

@media (max-width: 640px) {
    .tool-card {
        padding: 1.5rem;
    }
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.tool-icon {
    font-size: 2rem;
}

.tool-title {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.tool-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

/* ============================================
   FORMULÁRIOS
   ============================================ */

.input-group {
    margin: 1.5rem 0;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    transition: var(--transition);
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-primary);
}

.input-group input:hover,
.input-group select:hover {
    border-color: var(--border-hover);
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-group small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ============================================
   BOTÕES
   ============================================ */

button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

button::before, .btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:hover::before, .btn:hover::before {
    width: 300px;
    height: 300px;
}

button:hover, .btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

button:active, .btn:active {
    transform: translateY(0);
}

button:disabled, .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================
   DROPDOWN DE ESTADOS
   ============================================ */

.state-selector {
    position: relative;
    margin: 1.5rem 0;
}

.state-selector label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
}

.state-selector select {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-right: 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
}

.state-selector select:hover {
    border-color: var(--border-hover);
}

.state-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ============================================
   TOOLTIP
   ============================================ */

.tooltip {
    position: absolute;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    animation: tooltipBounce 0.5s ease;
    pointer-events: none;
    white-space: nowrap;
}

.tooltip::before {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--secondary-color);
}

@keyframes tooltipBounce {
    0%, 100% { transform: translate(-50%, 0); }
    50% { transform: translate(-50%, -5px); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ============================================
   BOTÕES DE COPIAR
   ============================================ */

.copy-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.copy-btn:active {
    transform: translateY(0);
}

.copy-btn.copied {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@media (max-width: 640px) {
    .copy-buttons {
        flex-direction: column;
    }

    .copy-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   RESULTADOS
   ============================================ */

.result {
    margin-top: 1.5rem;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.state-label {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1) 0%, transparent 100%);
    border-left: 3px solid var(--primary-color);
    border-radius: var(--border-radius-sm);
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.875rem;
    animation: slideInLeft 0.3s ease;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.result-display {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--bg-main);
    border-radius: var(--border-radius);
    margin: 1rem 0;
    border: 1px solid var(--border-color);
}

.result-value-new {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
    letter-spacing: 3px;
    text-align: center;
}

@media (max-width: 640px) {
    .result-value-new {
        font-size: 1.5rem;
        letter-spacing: 2px;
    }
}

/* ============================================
   CONTEÚDO SEO / EXPLICATIVO
   ============================================ */

.seo-content {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--border-radius);
    margin-top: 3rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    line-height: 1.8;
    color: var(--text-secondary);
}

@media (max-width: 640px) {
    .seo-content {
        padding: 1.5rem;
    }
}

.seo-content h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    margin-top: 2rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.seo-content h3:first-child {
    margin-top: 0;
}

.seo-content h4 {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
    font-size: 1.0625rem;
    font-weight: 600;
}

.seo-content p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.seo-content ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.seo-content li {
    margin-bottom: 0.5rem;
}

.seo-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.seo-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.seo-content table th,
.seo-content table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.seo-content table th {
    background: var(--bg-main);
    font-weight: 600;
    color: var(--text-primary);
}

.seo-content table tr:last-child td {
    border-bottom: none;
}

/* ============================================
   CARDS DE BOAS-VINDAS
   ============================================ */

.welcome-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.welcome-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.welcome-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.welcome-card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.welcome-card-title {
    color: var(--text-primary);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.welcome-card-count {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ============================================
   ALERTAS E AVISOS
   ============================================ */

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-sm);
    margin: 1rem 0;
    border-left: 4px solid;
}

.alert-warning {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.alert-info {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1e40af;
}

.alert-success {
    background: #d1fae5;
    border-color: #10b981;
    color: #065f46;
}

.alert-error {
    background: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}

/* ============================================
   OVERLAY MOBILE
   ============================================ */

.sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 850;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 768px) {
    .sidebar-overlay {
        display: none;
    }

    .sidebar-overlay.active {
        display: block;
    }
}

/* ============================================
   UTILITÁRIOS
   ============================================ */

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* ============================================
   PAINEL ADMIN LINK
   ============================================ */

.admin-panel-link-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}

.admin-panel-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.admin-panel-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    background: linear-gradient(135deg, #7c3aed, #a855f7);
}

.admin-panel-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.admin-panel-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sidebar colapsada: esconder texto */
.sidebar.collapsed .admin-panel-text {
    display: none;
}

.sidebar.collapsed .admin-panel-link {
    justify-content: center;
    padding: 0.875rem;
}

/* Mobile */
@media (max-width: 768px) {
    .admin-panel-link-container {
        position: static;
        margin-top: auto;
    }
}

/* Espaço no final da sidebar para o link admin */
.sidebar {
    padding-bottom: 100px; /* Espaço para o link admin fixo */
}

/* Sidebar colapsada: area do usuario */
.sidebar.collapsed .sidebar-user-area {
    text-align: center;
}

.sidebar.collapsed {
    padding-bottom: 90px;
}

@media (max-width: 768px) {
    .sidebar {
        padding-bottom: 1rem;
    }
}
