/* ===============================
   TOPBAR MELHORADA
================================ */
.topbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 32px;
    gap: 20px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
    overflow: visible;
}

.icon-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: block;
}

.icon-btn:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
}

/* ===============================
   PAGE HEADER
================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
    gap: 24px;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--text) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-header > div:first-child p {
    color: var(--text-muted);
    font-size: 15px;
    margin-top: 6px;
}

.actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
    align-items: center;
}

.actions button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.actions button svg {
    flex-shrink: 0;
}

.actions button span {
    display: flex;
    align-items: center;
}

.dropdown-wrapper {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    min-width: 200px;
    box-shadow: var(--shadow);
    overflow: hidden;
    z-index: 1000;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.2s ease;
}

.dropdown-menu.hidden {
    display: none;
}

.dropdown-menu-item {
    display: block;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s ease;
    border-bottom: 1px solid var(--border);
}

.dropdown-menu-item:last-child {
    border-bottom: none;
}

.dropdown-menu-item:hover {
    background: var(--surface-2);
    padding-left: 20px;
}

.dropdown-menu-item.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

/* ===============================
   ADVANCED FILTERS
================================ */
.filters-advanced {
    margin-bottom: 24px;
}

.search-box-main {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 2px solid var(--border);
    padding: 14px 18px;
    border-radius: 12px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    gap: 12px;
}

.search-box-main:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.search-box-main svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-box-main input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 15px;
    color: var(--text);
    background: transparent;
}

.search-box-main input::placeholder {
    color: var(--text-muted);
}

.search-clear {
    background: var(--bg);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-clear:hover {
    background: var(--border);
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-soft);
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-chip:hover {
    background: var(--primary-soft);
    opacity: 0.9;
}

.filter-chip svg {
    width: 14px;
    height: 14px;
}

/* ===============================
   STATS BAR
================================ */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.stat-desc {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===============================
   EXERCISE LIST
================================ */
.exercise-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ===============================
   EMPTY STATE
================================ */
.empty-state {
    padding: 80px 32px;
    text-align: center;
    background: var(--surface);
    border-radius: 16px;
    border: 2px dashed var(--border);
    margin-top: 40px;
}

.empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--bg) 0%, var(--border) 100%);
    border-radius: 20px;
    margin: 0 auto 24px;
}

.empty-icon svg {
    width: 40px;
    height: 40px;
    stroke: var(--text-muted);
    stroke-width: 1.5;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.empty-state .btn-primary {
    margin-top: 16px;
}

/* ===============================
   LOADING STATE
================================ */
.loading-state {
    padding: 80px 32px;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-state p {
    color: var(--text-muted);
    font-size: 15px;
}

/* ===============================
   DROPDOWN DIVIDER
================================ */
.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dropdown-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

/* ===============================
   RESPONSIVE
================================ */
@media (max-width: 1024px) {
    .stats-bar {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-actions {
        justify-content: space-between;
    }

    .page-header {
        flex-direction: column;
        gap: 16px;
    }

    .actions {
        width: 100%;
        flex-direction: column;
    }

    .actions button,
    .actions .dropdown-wrapper {
        width: 100%;
    }

    .page-header h1 {
        font-size: 24px;
    }

    .stats-bar {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .empty-state {
        padding: 60px 24px;
    }
}