:root {
    --primary-color: #1a73e8;
    --primary-light-color: #e8f0fe;
    --bg-color: #f8f9fa;
    --surface-color: #ffffff;
    --text-color: #202124;
    --muted-text-color: #5f6368;
    --border-color: #dadce0;
    --hover-color: #f1f3f4;
    --danger-color: #ea4335;
    --sidebar-width: 256px;
    --loader-track-color: #e0e0e0;
    --toast-bg: #323232;
    --toast-text: #ffffff;
    --shadow-color-md: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
    --shadow-color-lg: 0 4px 8px 3px rgba(60,64,67,0.15);
    --drag-overlay-bg: rgba(26, 115, 232, 0.95);
    --button-color: #4285f4; 
    --button-h-color: #3367d6;

    transition: 
        background-color 0.3s ease, 
        color 0.3s ease, 
        border-color 0.3s ease;
}

:root.dark-theme {
    --primary-color: #8ab4f8;
    --primary-light-color: #354964;
    --bg-color: #2d2e31;
    --button-color: #232429; 
    --button-h-color: #151519; 
    --surface-color: #303134;
    --text-color: #e8eaed; 
    --muted-text-color: #9aa0a6; 
    --border-color: #5f6368;
    --hover-color: #404144;
    --danger-color: #f28b82;
    --loader-track-color: #3c4043;
    --toast-bg: #e8eaed;
    --toast-text: #202124;
    --shadow-color-md: none;
    --shadow-color-lg: none;
    --drag-overlay-bg: rgba(138, 180, 248, 0.85);
}

html {
    transition: all .25s;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--surface-color); 
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    z-index: 100;
}

.logo {
    margin-bottom: 20px;
    font-size: 22px;
    color: var(--muted-text-color);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.btn-new {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    box-shadow: var(--shadow-color-md);
    transition: background 0.2s, box-shadow 0.2s;
    width: fit-content;
    margin-bottom: 24px;
}

.btn-new:hover {
    background-color: var(--primary-light-color); 
    box-shadow: var(--shadow-color-lg);
    color: var(--primary-color);
}

.nav-item {
    font-size: 14px; 
    color: var(--primary-color); 
    padding: 10px 12px; 
    background: var(--primary-light-color); 
    border-radius: 0 20px 20px 0; 
    font-weight: 500;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 90;
}

.main-content {
    flex: 1;
    background-color: var(--surface-color);
    margin: 16px 16px 16px 0;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.mobile-header {
    display: none;
    align-items: center;
    padding: 12px 16px;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}

.header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.header h2 { margin: 0; font-size: 18px; font-weight: 400; }

.user-token-display {
    font-size: 12px;
    color: var(--muted-text-color);
    background: var(--hover-color);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-list-container {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 600px; }

thead th {
    text-align: left;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-color);
    color: var(--muted-text-color);
    font-weight: 500;
    position: sticky;
    top: 0;
    background: var(--surface-color);
    z-index: 10;
}

tbody tr { border-bottom: 1px solid var(--hover-color); }
tbody tr:hover { background-color: var(--primary-light-color); }

tbody td {
    padding: 12px 24px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.token-cell {
    font-family: monospace;
    color: var(--muted-text-color);
    max-width: 120px;
}

.action-cell {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

.icon-btn {
    background: none; border: none; cursor: pointer; padding: 8px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: var(--muted-text-color);
    transition: all .25s;
}
.icon-btn:hover { 
    background-color: rgba(95,99,104, 0.1); 
    color: var(--text-color);
    transition: all .25s;
}
.icon-btn.delete:hover { 
    background-color: rgba(234,67,53, 0.1); 
    color: var(--danger-color); 
    transition: all .25s;
}

.loader { 
    display: none; width: 100%; height: 4px; 
    background: var(--loader-track-color); 
    position: absolute; top: 0; left: 0; z-index: 20; 
}
.loader .bar { width: 50%; height: 100%; background: var(--primary-color); animation: move 1.5s infinite ease-in-out; }
@keyframes move { 0% { transform: translateX(-100%); } 100% { transform: translateX(200%); } }

.toast {
    position: fixed; bottom: 24px; left: 32px; 
    background: var(--toast-bg); 
    color: var(--toast-text);
    padding: 12px 24px; border-radius: 4px; font-size: 14px; opacity: 0;
    transform: translateY(20px); transition: 0.3s; pointer-events: none; z-index: 2000;
}
.toast.show { opacity: 1; transform: translateY(0); }

.fab-upload {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background-color: var(--surface-color);
    border-radius: 50%;
    box-shadow: var(--shadow-color-lg);
    align-items: center;
    justify-content: center;
    z-index: 150;
    cursor: pointer;
    color: var(--primary-color);
}
.fab-upload svg { width: 32px; height: 32px; }

.modal {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4); 
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: var(--surface-color);
    margin: 15% auto;
    padding: 24px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: var(--shadow-color-md);
}

.close-btn {
    color: var(--muted-text-color);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.token-input {
    width: 100%;
    padding: 10px;
    margin: 10px 0 20px 0;
    box-sizing: border-box;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    font-family: monospace;
    background-color: var(--bg-color); 
    color: var(--text-color); 
}

.load-btn {
    background-color: var(--button-color);
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}
.load-btn:hover { background-color: var(--button-h-color); }

svg { width: 20px; height: 20px; fill: currentColor; }

svg.dd {width: 200px; height: 200px;}

@media (max-width: 1350px) {
    body { 
        flex-direction: column; 
        background: var(--surface-color); 
    }
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0;
        background: var(--surface-color);
        box-shadow: 2px 0 12px rgba(0,0,0,0.2);
        transform: translateX(-100%);
        width: 280px;
    }
    .file-list-container {
        padding-bottom: 96px; 
    }
    .sidebar.active { transform: translateX(0); }
    .sidebar-overlay.active { display: block; }
    .main-content { margin: 0; border: none; border-radius: 0; height: 100%; }
    .mobile-header { display: flex; }
    .header { display: none; }
    .sidebar .btn-new { display: none; }
    .fab-upload { display: flex; }
    table { min-width: 100%; display: block; }
    thead { display: none; }
    tbody { display: block; }
    tbody tr {
        display: flex; flex-wrap: wrap; align-items: center;
        padding: 12px 16px; position: relative;
        border-bottom: 1px solid var(--border-color);
    }
    tbody td { padding: 4px 0; border: none; display: block; max-width: none; }
    tbody td:nth-child(1) { width: 100%; font-weight: 500; font-size: 16px; margin-bottom: 4px; }
    tbody td:nth-child(2), 
    tbody td:nth-child(3),
    tbody td:nth-child(4),
    tbody td:nth-child(5) { 
        font-size: 12px; 
        color: var(--muted-text-color); 
        margin-right: 12px; 
        max-width: 120px; 
        display: inline-block; 
    }
    tbody td:nth-child(2)::before { content: "ID: "; }
    tbody td:nth-child(3)::before { content: "Key: "; }
    tbody td:nth-child(4)::before { content: "Views: "; }
    tbody td:nth-child(4)::before { content: "Size: "; }
    tbody td.action-cell {
        position: static; 
        transform: none; 
        right: auto;
        top: auto;
        
        width: 100%; 
        justify-content: flex-start;
        padding: 8px 0 0 0;
    }
    .toast { left: 50%; transform: translateX(-50%) translateY(20px); width: 80%; text-align: center; bottom: 80px; }
    .toast.show { transform: translateX(-50%) translateY(0); }
    .modal-content { margin: 30% auto; }
}

.user-token-display,
#fileTableBody td:nth-child(2) span,
#fileTableBody td:nth-child(3) span
{
    color: transparent;
    background-color: var(--border-color); 
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.3s;
}

.user-token-display:hover {
    color: var(--text-color); 
    border-radius: 6px;
    transition: color 0.3s;
    background-color: var(--hover-color);
}
#fileTableBody tr td:nth-child(2):hover span,
#fileTableBody tr td:nth-child(3):hover span 
{
    background: transparent;
    color: var(--text-color); 
    border-radius: 6px;
    transition: color 0.3s;
}

.drag-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--drag-overlay-bg); 
    color: white; 
    display: none; 
    
    flex-direction: column; 
    justify-content: center;
    align-items: center;

    font-size: 28px;
    font-weight: 500;
    z-index: 5000;
    pointer-events: none; 
    opacity: 0;
    transition: opacity 0.3s ease;
}

.drag-overlay.active {
    display: flex;
    opacity: 1;
}

.drag-overlay svg {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
}

.sidebar-section {
    padding: 8px 0;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

#themeToggle {
    width: 100%;
    padding: 10px 16px;
    font-weight: 500;
    text-align: center;
    border-radius: 26px;
    cursor: pointer;
    
    background-color: var(--surface-color); 
    color: var(--text-color);
    border: 1px solid var(--border-color);
    transition: 
        background-color 0.2s, 
        border-color 0.2s, 
        color 0.2s,
        box-shadow 0.2s;
}

#themeToggle:hover {
    background-color: var(--hover-color);
    box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
}

#themeToggle:active {
    opacity: 0.8;
}