* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success: #2ecc71;
    --danger: #ff4757;
    --warning: #ffa502;
    --info: #17a2b8;
}

/* Tema Light */
[data-theme="light"] {
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8f9fa;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    --border-color: #e0e0e0;
    --hover-bg: #f0f2f5;
    --shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
    --sidebar-bg: #ffffff;
    --sidebar-hover: #f5f7fa;
    --input-bg: #ffffff;
}

/* Tema Dark */
[data-theme="dark"] {
    --bg-primary: #1a1d23;
    --bg-secondary: #2c2f38;
    --bg-tertiary: #373b46;
    --text-primary: #e4e6eb;
    --text-secondary: #b0b3b8;
    --text-tertiary: #8a8d91;
    --border-color: #3e4149;
    --hover-bg: #3a3d47;
    --shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
    --sidebar-bg: #242730;
    --sidebar-hover: #2c2f38;
    --input-bg: #1e2128;
}

body {
    font-family: 'Poppins', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    transition: background 0.3s ease;
}

/* Layout Principal */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Navbar Superior */
.navbar {
    background: var(--primary-gradient);
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 70px;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

.navbar h1 {
    font-size: 24px;
    font-weight: 700;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Theme Toggle */
.theme-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    padding: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
    width: 60px;
    position: relative;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.theme-toggle-slider {
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

[data-theme="dark"] .theme-toggle-slider {
    transform: translateX(28px);
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 90px 0 20px 0;
    overflow-y: auto;
    transition: all 0.3s ease;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 999;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.sidebar-title {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.sidebar-menu {
    padding: 10px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    margin-bottom: 5px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
}

.menu-item:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
}

.menu-item.active {
    background: var(--primary-gradient);
    color: white;
}

.menu-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

/* Content Area */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 90px 30px 30px 30px;
    overflow-y: auto;
    transition: margin-left 0.3s ease;
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    animation: fadeIn 0.5s ease-out;
    border: 1px solid var(--border-color);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.card-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.card-header h2 {
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 600;
}

/* Forms */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 15px;
}

.form-group textarea,
.form-group input[type="text"],
.password-input {
    width: 100%;
    padding: 15px;
    background: var(--input-bg);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    transition: all 0.3s ease;
    outline: none;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-group textarea:focus,
.form-group input[type="text"]:focus,
.password-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Keyword Items */
.keyword-item {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    position: relative;
}

.keyword-item.inactive {
    opacity: 0.6;
}

.keyword-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.keyword-number {
    background: var(--primary-gradient);
    color: white;
    padding: 5px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 10px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.3);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #ff3838;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #ff8800;
}

.btn-save {
    /* width: 100%; */
    margin-top: 20px;
}

.btn-remove {
    background: var(--danger);
    color: white;
    border: none;
    padding: 6px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-remove:hover {
    background: #ff3838;
    transform: scale(1.05);
}

.keyword-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn-save-keyword {
    /* flex: 1; */
}

/* User Menu */
.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-menu {
    position: relative;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: white;
    color: #667eea;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.user-avatar:hover {
    transform: scale(1.05);
    border-color: white;
}

.user-dropdown {
    position: absolute;
    top: 55px;
    right: 0;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    display: none;
    z-index: 1000;
    animation: slideDown 0.3s ease;
    border: 1px solid var(--border-color);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-dropdown.show {
    display: block;
}

.dropdown-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-email {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 5px;
}

.dropdown-plan {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.plan-badge {
    background: var(--primary-gradient);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.dropdown-menu {
    padding: 10px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.dropdown-item:hover {
    background: var(--hover-bg);
}

.dropdown-item-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 10px 0;
}

/* Modal */
.modal-overlay-user {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.modal-overlay-user.show {
    display: flex;
}

.modal-content-user {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 30px;
    width: 90%;
    max-width: 450px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
    border: 1px solid var(--border-color);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header-user {
    text-align: center;
    margin-bottom: 25px;
}

.modal-header-user h2 {
    color: var(--text-primary);
    font-size: 24px;
    margin-bottom: 10px;
}

.modal-header-user p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Password */
.password-input-group {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-secondary);
    padding: 5px;
    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: #667eea;
}

.password-strength {
    margin-top: 8px;
    font-size: 12px;
}

.strength-bar {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin-top: 5px;
    overflow: hidden;
}

.strength-bar-fill {
    height: 100%;
    width: 0%;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.strength-weak {
    background: var(--danger);
    width: 33%;
}

.strength-medium {
    background: var(--warning);
    width: 66%;
}

.strength-strong {
    background: var(--success);
    width: 100%;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-cancel {
    flex: 1;
    padding: 14px;
    background: var(--hover-bg);
    color: var(--text-primary);
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel:hover {
    background: var(--border-color);
}

.btn-confirm {
    flex: 1;
    padding: 14px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loading-overlay.hide {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    /* border-top: 4px solid #667eea; */
    border-top: 4px solid var(--text-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    margin-top: 20px;
    font-size: 16px;
    /* color: #667eea; */
    color: var(--text-primary);
    font-weight: 600;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    animation: slideInRight 0.4s ease, fadeOut 0.4s ease 2.6s;
    font-size: 14px;
    font-weight: 500;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(400px);
    }
}

.notification-error {
    background: #fee;
    color: #c33;
    border-left: 4px solid #c33;
}

.notification-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.notification-warning {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.notification-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.notification-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.notification-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s;
    color: inherit;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    opacity: 1;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 10px;
}

.status-badge.active {
    background: rgba(46, 204, 113, 0.2);
    color: var(--success);
}

.status-badge.inactive {
    background: rgba(255, 165, 2, 0.2);
    color: var(--warning);
}

/* Help Text */
.help-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .sidebar {
        left: -280px;
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        margin-left: 0;
    }

    .navbar {
        padding: 15px 20px;
    }

    .navbar h1 {
        font-size: 20px;
    }

    .main-content {
        padding: 80px 15px 15px 15px;
    }

    .card {
        padding: 20px;
    }

    .keyword-actions {
        flex-direction: column;
    }

    .btn-save-keyword {
        width: 100%;
    }

    .user-dropdown {
        right: -20px;
    }
}

@media (max-width: 480px) {
    .navbar h1 {
        font-size: 18px;
    }

    .theme-toggle {
        width: 50px;
    }

    [data-theme="dark"] .theme-toggle-slider {
        transform: translateX(20px);
    }
}

/* Overlay para mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

@media (max-width: 768px) {
    .sidebar-overlay.active {
        display: block;
    }
}

/* Loading para seções */
.section-loading {
    position: fixed;
    /* Mudei de absolute para fixed */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(var(--bg-primary-rgb), 0.95);
    /* Adiciona transparência */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    /* Aumentei o z-index */
    opacity: 1;
    transition: opacity 0.3s ease;
}

.section-loading.hide {
    opacity: 0;
    pointer-events: none;
}

.section-loading .spinner {
    width: 50px;
    /* Aumentei um pouco */
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.section-loading .loading-text {
    margin-top: 20px;
    color: var(--text-primary);
    /* Mudei de secondary para primary */
    font-size: 16px;
    font-weight: 500;
}

/* Se não tiver a variável RGB, adicione no :root */
:root {
    --bg-primary-rgb: 255, 255, 255;
    /* Para tema claro */
}

[data-theme="dark"] {
    --bg-primary-rgb: 26, 32, 44;
    /* Para tema escuro */
}