/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    user-select: none;
}

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

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #6b46c1);
}

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

.btn-secondary:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

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

.btn-success:hover {
    background: #38a169;
}

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

.btn-danger:hover {
    background: #c53030;
}

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

.btn-outline:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--primary-color);
}

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

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    transition: var(--transition);
    background: var(--bg-primary);
}

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

.form-input.error,
.form-select.error,
.form-textarea.error {
    border-color: var(--danger-color);
}

.form-error {
    color: var(--danger-color);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.form-help {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Cards */
.card {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
    background: var(--bg-secondary);
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

/* Tables */
.table-container {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

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

.table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table tbody tr:hover {
    background: var(--bg-secondary);
}

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

/* Progress Bars */
.progress-bar {
    width: 100%;
    height: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.5s ease;
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(72, 187, 120, 0.1);
    border-color: var(--success-color);
    color: #22543d;
}

.alert-error {
    background: rgba(229, 62, 62, 0.1);
    border-color: var(--danger-color);
    color: #742a2a;
}

.alert-warning {
    background: rgba(237, 137, 54, 0.1);
    border-color: var(--warning-color);
    color: #744210;
}

.alert-info {
    background: rgba(49, 130, 206, 0.1);
    border-color: var(--info-color);
    color: #2c5282;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    gap: .35rem;
}

.badge-primary {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
}

.badge-success {
    background: rgba(72, 187, 120, 0.1);
    color: var(--success-color);
}

.badge-warning {
    background: rgba(237, 137, 54, 0.1);
    color: var(--warning-color);
}

.badge-danger {
    background: rgba(229, 62, 62, 0.1);
    color: var(--danger-color);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    min-width: 320px;
    width: 100%;
    max-width: min(500px, 90vw);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.2s ease;
    border: 1px solid var(--border-light);
}

.modal-overlay.show .modal {
    transform: scale(1);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: 60vh;
    flex: 1;
    font-size: 1rem;
    line-height: 1.5;
}

.modal-body p {
    margin: 0;
    color: var(--text-secondary);
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    background: var(--bg-secondary);
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

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

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modern loader visuals */
.modern-loader {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg);
    min-width: 120px;
    min-height: 120px;
}

.loader-glow {
    position: absolute;
    inset: -20px -25px;
    background: radial-gradient(80px 80px at 20% 30%, rgba(102,126,234,.15), transparent 60%),
                radial-gradient(90px 90px at 80% 70%, rgba(236,72,153,.12), transparent 60%);
    filter: blur(15px);
    z-index: 0;
    pointer-events: none;
}

/* SVG loader */
.loader-svg { 
    width: 60px; 
    height: 60px; 
    z-index: 1; 
}
.loader-track { stroke: var(--bg-tertiary, #eef2f7); opacity: .8; }
.loader-head { stroke: var(--primary-color, #667eea); stroke-dasharray: 125; stroke-dashoffset: 110; animation: loaderDash 1.2s ease-in-out infinite, spin 1s linear infinite; }
@keyframes loaderDash { 0% { stroke-dashoffset: 120; } 50% { stroke-dashoffset: 30; } 100% { stroke-dashoffset: 120; } }

.spinner-sm {
    width: 2rem;
    height: 2rem;
    border-width: 3px;
}

.loader-title {
    font-weight: 700;
    color: var(--text-primary);
    z-index: 1;
}

.loader-subtext {
    color: var(--text-secondary);
    font-size: 0.875rem;
    z-index: 1;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toast {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 1rem 1.5rem;
    min-width: 300px;
    border-left: 4px solid var(--primary-color);
    transform: translateX(100%);
    transition: var(--transition);
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

.toast.info {
    border-left-color: var(--info-color);
}

.toast-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.toast-title {
    font-weight: 600;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.toast-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.toast-message {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Utility Classes */
.d-inline {
    display: inline-block !important;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
}

/* Transaction Items */
.transactions-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.transaction-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.transaction-item:hover {
    background: var(--bg-tertiary);
    transform: translateX(4px);
}

.transaction-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}

.transaction-details {
    flex: 1;
}

.transaction-category {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.transaction-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.transaction-date {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.transaction-amount {
    font-weight: 700;
    font-size: 1.125rem;
}

.transaction-amount.income {
    color: var(--success-color);
}

.transaction-amount.expense {
    color: var(--danger-color);
}

/* Budget Items */
.budget-item {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}

.budget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.budget-category {
    font-weight: 600;
    color: var(--text-primary);
}

.budget-amount {
    font-weight: 700;
    color: var(--text-primary);
}

.budget-progress-bar {
    width: 100%;
    height: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.budget-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
}

.spent {
    color: var(--text-secondary);
}

.remaining {
    color: var(--success-color);
    font-weight: 600;
}

/* Goals Grid */
.goals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.goal-card {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    transition: var(--transition);
}

.goal-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.goal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.goal-header h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.goal-date {
    font-size: 0.875rem;
    color: var(--text-muted);
}

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

.goal-amounts {
    margin-bottom: 1rem;
}

.goal-amounts .current {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success-color);
}

.goal-amounts .separator {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin: 0 0.5rem;
}

.goal-amounts .target {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.goal-progress-bar {
    width: 100%;
    height: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.goal-percentage {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Plugin install shimmer */
.plugin-install-anim {
    position: relative;
    overflow: hidden;
}
.plugin-install-anim::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 0%, rgba(255,255,255,.08) 40%, rgba(255,255,255,.22) 50%, rgba(255,255,255,.08) 60%, transparent 100%);
    transform: translateX(-100%);
    animation: pluginShine 1.2s linear infinite;
}
@keyframes pluginShine { to { transform: translateX(100%); } }