:root {
    --bg-color: #050505;
    --panel-bg: #0a0a0a;
    --text-main: #e0e0e0;
    --text-dim: #666666;
    --accent: #00f0ff;
    --accent-dim: rgba(0, 240, 255, 0.1);
    --border: #333333;
    --success: #00ff41;
    --error: #ff0055;
    --font-mono: 'Space Mono', monospace;
    --qr-bg: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
    --bg-color: #f0f0f0;
    --panel-bg: #ffffff;
    --text-main: #111111;
    --text-dim: #888888;
    --accent: #0055ff;
    --accent-dim: rgba(0, 85, 255, 0.1);
    --border: #cccccc;
    --qr-bg: #ffffff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-mono);
    height: 100vh;
    overflow: hidden;
    font-size: 14px;
    transition: background-color 0.3s, color 0.3s;
}

button {
    font-family: var(--font-mono);
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.top-bar {
    height: 60px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background-color: var(--panel-bg);
}

.logo {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -1px;
}

.logo .icon {
    color: var(--accent);
}

.blink {
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.status-bar {
    font-size: 0.9rem;
    color: var(--text-dim);
}

.status-bar .separator {
    margin: 0 10px;
    color: var(--border);
}

.blur {
    filter: blur(4px);
    transition: filter 0.3s;
}

.blur:hover {
    filter: blur(0);
}

.controls {
    display: flex;
    gap: 15px;
}

.btn-text {
    font-size: 0.8rem;
    border: 1px solid var(--border);
    padding: 4px 8px;
    border-radius: 2px;
    transition: all 0.2s;
}

.btn-text:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Main Workspace */
.workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 300px;
    border-right: 1px solid var(--border);
    background-color: var(--panel-bg);
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
}

.panel h3 {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.75rem;
    color: var(--accent);
}

.input-group .row {
    display: flex;
    gap: 10px;
}

input[type="text"],
input[type="email"] {
    background: var(--bg-color);
    border: 1px solid var(--border);
    color: var(--text-main);
    font-family: var(--font-mono);
    padding: 8px;
    flex: 1;
    outline: none;
}

input[type="text"]:focus,
input[type="email"]:focus {
    border-color: var(--accent);
}

#btn-connect {
    background: var(--accent);
    color: #000;
    font-weight: bold;
    padding: 0 15px;
    transition: opacity 0.2s;
}

#btn-connect:hover {
    opacity: 0.8;
}

.qr-placeholder {
    margin-top: 20px;
    width: 100%;
    aspect-ratio: 1;
    background-color: var(--qr-bg);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    position: relative;
    overflow: hidden;
}

.scan-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 50%, rgba(0, 240, 255, 0.05) 51%);
    background-size: 100% 4px;
    pointer-events: none;
}

.log-list {
    list-style: none;
    font-size: 0.75rem;
    color: var(--text-dim);
    overflow-y: auto;
    max-height: 200px;
}

.log-item {
    margin-bottom: 5px;
    word-break: break-all;
}

.log-item::before {
    content: '>';
    margin-right: 5px;
    color: var(--accent);
}

/* Desktop Area */
.desktop-area {
    flex: 1;
    background-color: var(--bg-color);
    padding: 30px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.desktop-area.drag-over {
    background-color: var(--accent-dim);
    border: 2px dashed var(--accent);
}

.desktop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.desktop-header h2 {
    font-size: 1.5rem;
    font-weight: 400;
}

.btn-action {
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 10px 20px;
    font-weight: bold;
    transition: all 0.2s;
}

.btn-action:hover {
    background: var(--accent);
    color: #000;
}

.file-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    grid-auto-rows: 160px; /* Increased height to prevent cutting off */
    gap: 20px;
    overflow-y: auto;
    position: relative;
}

.empty-state {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    opacity: 0.5;
    pointer-events: none;
}

.empty-icon {
    margin-bottom: 15px;
    color: var(--text-dim);
    transition: color 0.3s;
}

.empty-icon svg {
    display: block;
}

/* File Item */
.file-item {
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.file-item:hover {
    background-color: var(--accent-dim);
    border-color: var(--accent);
}

.file-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.file-name {
    font-size: 0.8rem;
    word-break: break-word;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Allow 2 lines */
    -webkit-box-orient: vertical;
    line-height: 1.3;
    margin-bottom: 4px;
    min-height: 2.6em; /* Reserve space for 2 lines to align items */
    display: flex; /* Fallback/Alternative for centering if needed, but -webkit-box is primary for clamp */
    align-items: center;
    justify-content: center;
}

/* Reset display for line-clamp to work */
@supports (-webkit-line-clamp: 2) {
    .file-name {
        display: -webkit-box;
    }
}

.file-size {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-bottom: 5px;
}

.file-progress {
    width: 100%;
    height: 2px;
    background: var(--border);
    margin-top: 5px;
}

.progress-bar {
    height: 100%;
    background: var(--accent);
    width: 0%;
}

/* Footer */
.status-footer {
    height: 30px;
    border-top: 1px solid var(--border);
    background-color: var(--panel-bg);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 20px;
    font-size: 0.7rem;
    color: var(--text-dim);
}

.secure {
    color: var(--success);
}

/* Icons */
.btn-icon-small {
    font-size: 1rem;
    opacity: 0.4;
    transition: opacity 0.2s, color 0.2s;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dim);
}

.btn-icon-small:hover {
    opacity: 1;
    color: var(--accent);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(5px);
}

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

.modal-content {
    background: var(--panel-bg);
    border: 1px solid var(--accent);
    padding: 30px;
    width: 400px;
    max-width: 90%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.1);
}

.modal-content h3 {
    color: var(--accent);
    font-size: 1.2rem;
    margin-bottom: 10px;
    font-family: var(--font-mono);
}

.btn-primary {
    background: var(--accent);
    color: #000;
    padding: 8px 16px;
    font-weight: bold;
    border: none;
    font-family: var(--font-mono);
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-main);
    padding: 8px 16px;
    font-family: var(--font-mono);
}

.btn-secondary:hover {
    border-color: var(--text-main);
}

/* Mobile Controls */
.mobile-controls {
    display: none;
    background: var(--panel-bg);
    border-top: 1px solid var(--border);
    padding: 15px;
    flex-direction: column;
    gap: 10px;
}

.mobile-row {
    display: flex;
    gap: 10px;
}

.mobile-row input {
    flex: 1;
    background: var(--bg-color);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 10px;
    font-family: var(--font-mono);
}

.mobile-row button {
    white-space: nowrap;
}

.mobile-row.action-row button {
    flex: 1;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .mobile-controls {
        display: flex;
    }

    .status-footer {
        display: none;
    }
    
    .top-bar .status-bar {
        display: none;
    }
    
    .top-bar {
        padding: 0 10px;
    }
    
    .logo {
        font-size: 1rem;
    }
}
/ *   M o b i l e   R e s p o n s i v e n e s s   * / 
 
 @ m e d i a   ( m a x - w i d t h :   7 6 8 p x )   { 
 
         . s t a t u s - f o o t e r   { 
 
                 h e i g h t :   a u t o ; 
 
                 f l e x - w r a p :   w r a p ; 
 
                 p a d d i n g :   1 0 p x   2 0 p x ; 
 
                 j u s t i f y - c o n t e n t :   c e n t e r ; 
 
         } 
 
 
 
         . s t a t u s - f o o t e r   . s t a t   { 
 
                 m a r g i n - r i g h t :   1 0 p x ; 
 
                 m a r g i n - b o t t o m :   5 p x ; 
 
         } 
 
 
 
         # l e g a l - l i n k   { 
 
                 m a r g i n - l e f t :   0   ! i m p o r t a n t ;   / *   R e s e t   a u t o   m a r g i n   o n   m o b i l e   t o   c e n t e r   o r   f l o w   n a t u r a l l y   * / 
 
                 w i d t h :   1 0 0 % ; 
 
                 t e x t - a l i g n :   c e n t e r ; 
 
                 m a r g i n - t o p :   5 p x ; 
 
         } 
 
 
 
         . m o d a l - c o n t e n t   { 
 
                 w i d t h :   9 5 % ; 
 
                 p a d d i n g :   2 0 p x ; 
 
         } 
 
 } 
 
 