/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-5);
    font-size: var(--text-sm);
    font-weight: 600;
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    white-space: nowrap;
    line-height: 1.5;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--gray-200);
    border-color: var(--border-dark);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--gray-100);
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    color: white;
}

.btn-lg {
    padding: var(--space-3) var(--space-8);
    font-size: var(--text-base);
    border-radius: var(--radius-xl);
}

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
}

.btn-icon {
    padding: var(--space-2);
    border-radius: var(--radius);
}

/* === Cards === */
.card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    transition: all var(--transition);
}

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

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.card-title {
    font-size: var(--text-lg);
    font-weight: 700;
}

.card-body {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.7;
}

/* === Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15em 0.6em;
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    line-height: 1.5;
    white-space: nowrap;
}

.badge-primary {
    background: var(--primary-100);
    color: var(--primary-700);
}

.badge-pro {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    width: fit-content;
    padding: 0.15em 0.6em;
    font-size: 0.625rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    line-height: 1.5;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.badge-basic {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    width: fit-content;
    padding: 0.15em 0.6em;
    font-size: 0.625rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    line-height: 1.5;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.badge-free {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    width: fit-content;
    padding: 0.15em 0.6em;
    font-size: 0.625rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    line-height: 1.5;
    background: var(--success);
    color: white;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.badge-max {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    width: fit-content;
    padding: 0.15em 0.6em;
    font-size: 0.625rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    line-height: 1.5;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: white;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-info {
    background: #cffafe;
    color: #155e75;
}

.badge-secondary {
    background: var(--bg-tertiary, #f3f4f6);
    color: var(--text-secondary);
}

/* === Form Elements === */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--space-1);
}

.form-input {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg);
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.form-input::placeholder {
    color: var(--gray-400);
}

.form-input-icon {
    position: relative;
}

.form-input-icon .form-input {
    padding-left: var(--space-10);
}

.form-input-icon svg,
.form-input-icon i[class*="icf-"] {
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    font-size: 18px;
    color: var(--gray-400);
}

.form-select {
    width: 100%;
    padding: var(--space-2) 2rem var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg) 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='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
    appearance: none;
    outline: none;
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.form-error {
    font-size: var(--text-xs);
    color: var(--danger);
    margin-top: var(--space-1);
}

/* === Tabs === */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: var(--space-4);
    gap: var(--space-1);
}

.tab {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* === Code Block with Copy === */
.code-block {
    position: relative;
}

.code-block pre {
    padding-right: var(--space-12);
}

.pro-svg-notice {
    color: var(--gray-400);
    font-style: italic;
}

.pro-svg-notice .icf-lock {
    font-size: 0.85em;
    margin-right: 4px;
}

.pro-svg-notice a {
    color: var(--primary-300);
    text-decoration: underline;
}

.pro-svg-notice a:hover {
    color: var(--primary-200);
}

.code-copy-btn {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    background: rgba(255, 255, 255, 0.1);
    color: var(--gray-400);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.code-copy-btn.copied {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

/* === Modal === */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    z-index: var(--z-modal);
    background: var(--bg);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    min-width: 400px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition);
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.modal-title {
    font-size: var(--text-lg);
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--text);
}

/* === Toast === */
.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.toast {
    padding: var(--space-3) var(--space-4);
    background: var(--gray-900);
    color: white;
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    box-shadow: var(--shadow-lg);
    animation: toast-in 0.3s ease;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-info { border-left: 4px solid var(--info); }

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

/* === Loading Skeleton === */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s infinite;
    border-radius: var(--radius);
}

@keyframes skeleton-pulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* === Tag === */
.tag {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: 500;
    background: var(--gray-100);
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.tag:hover {
    background: var(--gray-200);
    color: var(--text);
}

/* === Tooltip === */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    background: var(--gray-900);
    color: white;
    border-radius: var(--radius);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    z-index: 100;
}

[data-tooltip]:hover::after {
    opacity: 1;
}

/* === Alert === */
.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* === Table === */
.table-wrapper {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table th {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--gray-50);
    border-bottom: 2px solid var(--border);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-light);
}

.table tr:hover td {
    background: var(--gray-50);
}

/* === Pagination === */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    margin-top: var(--space-8);
}

.pagination-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 500;
    border-radius: var(--radius);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.pagination-btn:hover {
    background: var(--gray-100);
    color: var(--text);
}

.pagination-btn.active {
    background: var(--primary);
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* === Nav Avatar Dropdown === */
.dash-user-avatar {
    border-radius: 50%;
    background: var(--primary-100, #e0e7ff);
    color: var(--primary-700, #4338ca);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.dash-user-avatar-sm {
    width: 32px;
    height: 32px;
    font-size: var(--text-sm, 0.875rem);
}

.nav-avatar-dropdown {
    position: relative;
}

.nav-avatar-toggle {
    cursor: pointer;
}

.nav-avatar-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--gray-900, #0f172a);
    border: 1px solid var(--gray-700, #334155);
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 9999;
    overflow: hidden;
}

.nav-avatar-menu.open {
    display: block;
}

.dash-avatar-menu-header {
    padding: var(--space-3, 12px) var(--space-4, 16px);
}

.dash-avatar-menu-name {
    font-size: var(--text-sm, 0.875rem);
    font-weight: 600;
    color: var(--gray-100, #f1f5f9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-avatar-menu-email {
    font-size: var(--text-xs, 0.75rem);
    color: var(--gray-400, #94a3b8);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-avatar-menu-divider {
    height: 1px;
    background: var(--gray-700, #334155);
    margin: var(--space-1, 4px) 0;
}

.dash-avatar-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-3, 12px);
    padding: var(--space-2, 8px) var(--space-4, 16px);
    font-size: var(--text-sm, 0.875rem);
    color: var(--gray-300, #cbd5e1);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.dash-avatar-menu-item:hover {
    background: var(--gray-800, #1e293b);
    color: var(--gray-100, #f1f5f9);
}

.dash-avatar-menu-item i {
    width: 16px;
    text-align: center;
    font-size: 14px;
    color: var(--gray-400, #94a3b8);
    flex-shrink: 0;
}

.dash-avatar-menu-item:hover i {
    color: var(--gray-300, #cbd5e1);
}

.dash-avatar-menu-item-danger {
    color: var(--red-400, #f87171);
}

.dash-avatar-menu-item-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red-400, #f87171);
}

.dash-avatar-menu-item-danger i {
    color: var(--red-400, #f87171);
}
