/* =================================================================================
 * BITFILE ENTERPRISE DESIGN SYSTEM v6.3.0
 * ================================================================================= */

/* --- TYPOGRAPHY --- */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300..800;1,300..800&display=swap');

/* --- CSS VARIABLES --- */
:root {
    --bg-app: #050505;
    --bg-sidebar: #0a0a0a;
    --bg-card: rgba(18, 22, 32, 0.75);
    --bg-input: #1a1a1a;
    --bg-surface: rgba(20, 20, 20, 0.95);
    --accent-primary: #3b82f6;
    --accent-secondary: #6366f1;
    --accent-glow: rgba(59, 130, 246, 0.4);
    --accent-grad: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    --text-main: #ffffff;
    --text-muted: #9ca3af;
    --text-dim: #4b5563;
    --border-color: #27272a;
    --border-light: #3f3f46;
    --status-success: #10b981;
    --status-warning: #f59e0b;
    --status-danger: #ef4444;
    --status-info: #0ea5e9;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    --ease-elastic: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --ease-material: cubic-bezier(0.4, 0.0, 0.2, 1);
    --nav-height: 70px;
    --sidebar-width: 280px;
}

/* --- LIGHT THEME STYLING SYSTEM --- */
body.light-theme, [data-theme="light"] {
    --bg-app: #f1f5f9;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f8fafc;
    --bg-surface: rgba(255, 255, 255, 0.95);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-dim: #94a3b8;
    --border-color: #e2e8f0;
    --border-light: #cbd5e1;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.08);
}

body.light-theme .bf-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05) !important;
    color: #0f172a !important;
}

body.light-theme .list-item {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
    color: #0f172a !important;
}

body.light-theme .drop-area {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

body.light-theme .bf-input {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

body.light-theme .pc-sidebar {
    background: #ffffff !important;
    border-right: 1px solid #e2e8f0 !important;
}

body.light-theme .pc-menu-item {
    color: #64748b;
}

body.light-theme .pc-menu-item:hover, body.light-theme .pc-menu-item.active {
    color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.08);
}

body.light-theme .empty-state {
    color: #64748b !important;
}

body.light-theme h1, body.light-theme h2, body.light-theme h3, body.light-theme h4, body.light-theme .bf-card-title {
    color: #0f172a !important;
}

body.light-theme .text-muted, body.light-theme div[style*="color:var(--text-muted)"], body.light-theme span[style*="color:var(--text-muted)"] {
    color: #64748b !important;
}

/* --- GLOBAL RESET & STATIC POSITIONING --- */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    outline: none; 
    -webkit-tap-highlight-color: transparent; 
    user-select: none; 
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Disable all zoom, rotation, scaling, and transform hover effects */
*:hover, *:active, *:focus,
i:hover, svg:hover, button:hover, .btn:hover, .bf-card:hover, .list-item:hover, .drop-area:hover i, .avatar:hover {
    transform: none !important;
}

*:not(i):not([class*="fa-"]):not([class*="fa"]) {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

i, .fa, .fas, .far, .fab, .fal, .fad, [class*="fa-"] {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands", "FontAwesome" !important;
}

html, body {
    height: 100%;
    width: 100%;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    background-color: var(--bg-app);
    color: var(--text-main);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

input, textarea {
    user-select: text;
}

/* --- UTILITY CLASSES --- */
.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.2s ease-out forwards; }
.slide-up { opacity: 1 !important; transform: none !important; }
.text-truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- ANIMATIONS --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 1; } to { opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* --- BACKGROUND MESH --- */
.bg-mesh {
    position: fixed; 
    inset: 0; 
    z-index: 0;
    background: 
        radial-gradient(circle at 10% 10%, rgba(59, 130, 246, 0.08), transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(99, 102, 241, 0.08), transparent 40%);
    pointer-events: none;
}

/* =================================================================================
 * MOBILE LAYOUT
 * ================================================================================= */
#mobile-layout {
    display: none;
    flex-direction: column;
    height: 100%;
    position: relative;
    z-index: 10;
}

@media (max-width: 768px) {
    #mobile-layout { display: flex; }
    #desktop-layout { display: none !important; }
}

.mob-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: rgba(5, 5, 5, 0.9);
    backdrop-filter: blur(25px);
    border-bottom: 1px solid var(--border-color);
    z-index: 50;
    flex-shrink: 0;
}

.mob-brand { 
    font-size: 18px; 
    font-weight: 700; 
    background: var(--accent-grad); 
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent; 
}

.mob-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.mob-view {
    position: absolute;
    inset: 0;
    padding: 20px;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 80px;
}

.mob-view.active { 
    display: flex; 
    animation: fadeIn 0.3s ease;
}

.mob-nav {
    height: var(--nav-height);
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(15px);
    border-top: 1px solid var(--border-color);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    z-index: 50;
    flex-shrink: 0;
}

.mob-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s var(--ease-material);
    position: relative;
}

.mob-nav-item i { font-size: 20px; transition: transform 0.2s var(--ease-elastic); }
.mob-nav-item span { font-size: 10px; font-weight: 600; }

.mob-nav-item.active { color: var(--accent-primary); }
.mob-nav-item.active i { transform: translateY(-3px) scale(1.1); }
.mob-nav-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40%;
    height: 2px;
    background: var(--accent-primary);
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* =================================================================================
 * DESKTOP LAYOUT
 * ================================================================================= */
#desktop-layout {
    display: flex;
    height: 100%;
    position: relative;
    z-index: 10;
}

.pc-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    flex-shrink: 0;
}

.pc-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.pc-brand img {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.pc-brand h1 {
    font-size: 20px;
    font-weight: 700;
}

.pc-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.pc-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.2s var(--ease-material);
    font-weight: 500;
    border: 1px solid transparent;
}

.pc-menu-item:hover { 
    background: rgba(255,255,255,0.05); 
    color: var(--text-main); 
    transform: translateX(4px);
}

.pc-menu-item.active { 
    background: rgba(59, 130, 246, 0.1); 
    color: var(--accent-primary); 
    border-color: rgba(59, 130, 246, 0.2);
}

.pc-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    background: radial-gradient(circle at 100% 0%, rgba(59,130,246,0.05), transparent 30%);
}

.pc-view { 
    display: none; 
    flex-direction: column; 
    height: 100%; 
    max-width: 1400px; 
    margin: 0 auto; 
}

.pc-view.active {
    display: flex;
    animation: fadeIn 0.4s ease;
}

/* =================================================================================
 * COMPONENTS
 * ================================================================================= */

/* Cards */
.bf-card {
    background: rgba(18, 22, 32, 0.75);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 36px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    transition: all 0.3s ease;
}

.bf-card:hover {
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
}

.bf-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.bf-card-title {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Status Pills */
.status-pill {
    padding: 8px 16px;
    border-radius: 24px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.status-pill:hover {
    background: rgba(255,255,255,0.05);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.status-dot.online {
    background: var(--status-success);
    box-shadow: 0 0 8px var(--status-success);
}

.status-dot.connecting {
    background: var(--status-warning);
    animation: pulse 1s infinite;
}

.status-dot.offline {
    background: var(--status-danger);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 14px;
    border: none;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.1s var(--ease-material);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    user-select: none;
}

.btn:active {
    opacity: 0.9;
}

.btn-primary { 
    background: var(--accent-grad); 
    color: white; 
    box-shadow: 0 4px 14px rgba(59,130,246,0.35); 
}

.btn-primary:hover {
    box-shadow: 0 6px 18px rgba(59,130,246,0.55);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-ghost { 
    background: transparent; 
    border: 1px solid var(--border-color); 
    color: var(--text-muted); 
}

.btn-ghost:hover {
    border-color: var(--text-main);
    color: var(--text-main);
    background: rgba(255,255,255,0.05);
}

.btn-ghost-danger {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-ghost-danger:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.45);
    color: #ef4444;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.btn-ghost-danger:active {
    transform: translateY(0) scale(0.97);
}

/* Inputs */
.input-group {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.bf-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 14px 18px;
    border-radius: 14px;
    color: white;
    font-size: 15px;
    font-weight: 500;
    transition: border-color 0.2s;
}

.bf-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Lists */
.list-item {
    background: rgba(255,255,255,0.03);
    border-radius: 16px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 14px;
    border: 1px solid transparent;
    transition: 0.2s var(--ease-material);
}

.list-item:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--border-light);
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Settings */
.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-info h4 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.setting-info p {
    font-size: 11px;
    color: var(--text-muted);
}

.toggle-switch {
    width: 44px;
    height: 24px;
    background: #333;
    border-radius: 24px;
    position: relative;
    cursor: pointer;
    transition: 0.3s;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.toggle-switch.active::after {
    transform: translateX(20px);
}

/* Drop Zone */
.drop-area {
    border: 2px dashed var(--border-light);
    border-radius: 20px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
    background: rgba(0,0,0,0.2);
}

.drop-area:hover, .drop-area.dragover { 
    border-color: var(--accent-primary); 
    background: rgba(59,130,246,0.05); 
}

@media (max-width: 768px) {
    .bf-card {
        padding: 20px !important;
        border-radius: 18px !important;
        margin-bottom: 18px !important;
    }
    .list-item {
        padding: 14px 16px !important;
        gap: 10px !important;
        border-radius: 14px !important;
    }
    .mob-header {
        padding: 12px 16px !important;
        height: auto !important;
    }
    .mob-viewport {
        padding: 14px !important;
    }
    .input-group {
        margin-bottom: 14px !important;
    }
    .bf-input {
        padding: 12px 14px !important;
        font-size: 14px !important;
    }
    .btn {
        padding: 10px 16px !important;
        font-size: 13px !important;
    }
}

.drop-area i {
    transition: transform 0.3s var(--ease-elastic);
}

.drop-area:hover i {
    color: var(--accent-primary) !important;
}

/* Debug Console */
#debug-console {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: #000;
    border-top: 1px solid #333;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 10px;
    color: #0f0;
    padding: 10px;
    overflow-y: auto;
    z-index: 9999;
    display: none;
}

/* Toasts */
#toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

@media (max-width: 768px) {
    #toast-container {
        bottom: 90px;
        right: 20px;
        left: 20px;
    }
}

.toast {
    background: var(--bg-surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-light);
    padding: 12px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
    pointer-events: auto;
    min-width: 250px;
}

.toast i {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-success {
    border-left: 4px solid var(--status-success);
}

.toast-error {
    border-left: 4px solid var(--status-danger);
}

.toast-info {
    border-left: 4px solid var(--status-info);
}

.toast-warning {
    border-left: 4px solid var(--status-warning);
}

/* Modal System */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0);
    backdrop-filter: blur(0px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-footer .btn {
    min-width: 100px;
}

/* Transfer Grid */
.transfer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    opacity: 0.3;
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 14px;
}

/* Accent Color Selector */
.accent-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.accent-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.accent-dot:hover {
    transform: scale(1.1);
}

.accent-dot.active {
    border-color: white;
    box-shadow: 0 0 0 2px var(--bg-card), 0 0 12px currentColor;
}

/* Setting Groups */
.setting-group {
    margin-bottom: 32px;
}

.setting-group-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

/* Light Theme Support */
body.light-theme {
    --bg-app: #f5f5f5;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f0f0f0;
    --bg-surface: rgba(255, 255, 255, 0.95);
    --text-main: #000000;
    --text-muted: #666666;
    --text-dim: #999999;
    --border-color: #e0e0e0;
    --border-light: #d0d0d0;
}

body.light-theme .bg-mesh {
    background: 
        radial-gradient(circle at 10% 10%, rgba(59, 130, 246, 0.05), transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(99, 102, 241, 0.05), transparent 40%);
}

body.light-theme .bf-input {
    color: #000000;
}

body.light-theme .toggle-switch::after {
    background: #666666;
}

body.light-theme .toggle-switch.active::after {
    background: white;
}

/* Reduce Motion Support */
body.reduce-motion * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

/* High Contrast Support */
body.high-contrast {
    --text-main: #ffffff;
    --text-muted: #e0e0e0;
    --border-color: #ffffff40;
}

body.light-theme.high-contrast {
    --text-main: #000000;
    --text-muted: #333333;
    --border-color: #00000040;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-card);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Responsive Adjustments */
@media (max-width: 1200px) {
    .pc-content {
        padding: 20px;
    }
    
    #pc-view-dashboard > div {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .modal-header, .modal-body, .modal-footer {
        padding: 16px;
    }
}

/* =================================================================================
 * SMOOTH BUTTON & TOGGLE ANIMATIONS
 * ================================================================================= */

/* Enhanced Button Animations */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.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;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover {
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-ghost {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-ghost:hover {
    transform: translateY(-2px);
}

.btn-ghost:active {
    transform: translateY(0) scale(0.98);
}

/* Smooth Toggle Switch Animations */
.toggle-switch {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-switch::after {
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.toggle-switch:hover {
    transform: scale(1.05);
}

.toggle-switch:active {
    transform: scale(0.98);
}

.toggle-switch.active {
    box-shadow: inset 0 2px 8px rgba(59, 130, 246, 0.3);
}

.toggle-switch.active::after {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Icon Rotation on Toggle */
.setting-item {
    transition: all 0.3s ease;
}

.setting-item:hover {
    background: rgba(255, 255, 255, 0.02);
    padding-left: 8px;
}

/* Accent Dot Animations */
.accent-dot {
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
}

.accent-dot::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

.accent-dot:hover {
    transform: scale(1.15) rotate(10deg);
}

.accent-dot:active {
    transform: scale(0.95);
}

.accent-dot.active {
    transform: scale(1.1);
    animation: accentPulse 2s ease-in-out infinite;
}

.accent-dot.active::before {
    opacity: 0.2;
    transform: scale(1);
}

@keyframes accentPulse {
    0%, 100% {
        box-shadow: 0 0 0 2px var(--bg-card), 0 0 12px currentColor;
    }
    50% {
        box-shadow: 0 0 0 2px var(--bg-card), 0 0 20px currentColor;
    }
}

/* Status Pill Smooth Transitions */
.status-pill {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.status-pill:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.status-pill:active {
    transform: scale(0.98);
}

.status-dot {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* List Item Smooth Hover */
.list-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.list-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Card Hover Effects */
.bf-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bf-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Input Focus Animations */
.bf-input {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bf-input:focus {
    transform: translateY(-2px);
}

/* Menu Item Animations */
.pc-menu-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.pc-menu-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--accent-primary);
    border-radius: 0 2px 2px 0;
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pc-menu-item:hover::before {
    height: 60%;
}

.pc-menu-item.active::before {
    height: 80%;
}

/* Mobile Nav Item Enhanced */
.mob-nav-item {
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.mob-nav-item:active {
    transform: scale(0.95);
}

.mob-nav-item.active::after {
    animation: slideDown 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes slideDown {
    from {
        transform: translateX(-50%) translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Drop Area Animation */
.drop-area {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.drop-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, var(--accent-primary), transparent);
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.4s ease;
}

.drop-area:hover::before,
.drop-area.dragover::before {
    opacity: 0.1;
    transform: scale(1);
}

.drop-area:hover {
    transform: scale(1.02);
}

/* Toast Slide In Animation */
.toast {
    animation: toastSlideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes toastSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Modal Content Animation */
.modal-overlay.active .modal-content {
    animation: modalBounceIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes modalBounceIn {
    from {
        transform: scale(0.7) translateY(-50px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Avatar Bounce on Hover */
.avatar {
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.list-item:hover .avatar {
    transform: scale(1.1) rotate(5deg);
}

/* Progress Bar Smooth Animation */
.transfer-grid .bf-card [style*="width"] {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Smooth Scrollbar */
* {
    scroll-behavior: smooth;
}

/* Icon Spin on Click */
@keyframes iconSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.fas.fa-sync:active,
.fas.fa-redo:active {
    animation: iconSpin 0.6s ease-in-out;
}

/* Pulse Effect for Important Buttons */
@keyframes buttonPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

.btn-primary:focus {
    animation: buttonPulse 1.5s infinite;
}

/* Smooth Color Transitions on Theme Change */
* {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-duration: 0.3s;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Override for specific animations that should remain fast */
.fade-in,
.slide-up,
.toast,
.modal-content {
    transition: none !important;
}
/* =================================================================================
 * UI OPTIMIZATION FIXES
 * ================================================================================= */

/* 1. Fix Button Alignment and Overflow */
.btn {
    display: inline-flex;
    align-items: center;      /* Vertically centers text/icons */
    justify-content: center;   /* Horizontally centers text/icons */
    text-align: center;
    white-space: nowrap;       /* Prevents text from wrapping to a second line */
    overflow: hidden;          /* Prevents text from bleeding out of the radius */
    text-overflow: ellipsis;   /* Adds '...' if text is somehow too long */
    line-height: 1;            /* Resets line height to prevent vertical offset */
    min-height: 38px;          /* Ensures a consistent touch target and height */
    padding: 0 16px;           /* Balanced horizontal padding */
}

/* 2. Specific fix for Peer ID Input and Connect Button group */
/* This ensures the 'Connect' button doesn't shrink and the text stays centered */
.pc-view .bf-card .input-group,
.discovery-container { /* Adjust this selector to match your HTML structure */
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.btn-primary {
    flex-shrink: 0;            /* Prevents the button from being squashed by the input */
}

/* 3. Fix for the 'Send' button in the peer list item */
.list-item .btn {
    padding: 8px 16px;         /* Slightly tighter padding for list buttons */
    font-size: 12px;
}

.list-item .btn i {
    font-size: 14px;           /* Ensure icon size doesn't push the height */
}

/* 4. Fix for Peer ID text overflow (BF-0JT6BC...) */
.list-item div p, 
.list-item .peer-id-text {
    max-width: 150px;          /* Adjust based on your layout */
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    display: block;
}

/* 5. Improve Input centering */
.bf-input {
    display: flex;
    align-items: center;
    line-height: normal;       /* Better vertical alignment for placeholder text */
}