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

:root {
    --primary: #1a73e8;
    --primary-hover: #1557b0;
    --bg: #f8f9fa;
    --surface: #ffffff;
    --text: #202124;
    --text-secondary: #5f6368;
    --border: #e0e0e0;
    --hover: #f1f3f4;
    --danger: #d93025;
    --success: #188038;
    --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* LOGIN PAGE */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    margin: 20px;
}

.login-card h1 {
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 8px;
    color: var(--text);
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 14px;
}

.login-card .cloud-icon {
    text-align: center;
    font-size: 48px;
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
    padding: 12px;
}

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

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

.btn-secondary:hover { background: var(--hover); }

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

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

.btn-icon {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
}

.btn-icon:hover { background: var(--hover); }

.error-msg {
    background: #fce8e6;
    color: var(--danger);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 20px;
}

/* MAIN LAYOUT */
.app-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
}

.app-header .logo svg {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-info {
    font-size: 13px;
    color: var(--text-secondary);
    margin-right: 8px;
}

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* TOOLBAR */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
}

.breadcrumb a:hover { background: var(--hover); }

.breadcrumb span.separator {
    color: var(--text-secondary);
    font-size: 18px;
}

.breadcrumb span.current {
    color: var(--text);
    font-weight: 500;
    padding: 4px 8px;
}

.toolbar-actions {
    display: flex;
    gap: 8px;
}

/* UPLOAD ZONE */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    margin-bottom: 24px;
    transition: all 0.2s;
    cursor: pointer;
    background: var(--surface);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(26, 115, 232, 0.04);
}

.upload-zone svg {
    width: 48px;
    height: 48px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.upload-zone p {
    color: var(--text-secondary);
    font-size: 14px;
}

.upload-zone .browse-link {
    color: var(--primary);
    font-weight: 500;
    cursor: pointer;
}

/* UPLOAD PROGRESS */
.upload-progress {
    margin-bottom: 24px;
}

.upload-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.upload-item .file-name {
    flex: 1;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-item .progress-bar {
    width: 120px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.upload-item .progress-bar .fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s;
}

.upload-item .progress-bar .fill.complete {
    background: var(--success);
}

.upload-item .status {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 48px;
    text-align: right;
}

/* FILE TABLE */
.file-table-wrapper {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

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

.file-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    user-select: none;
}

.file-table td {
    padding: 10px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

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

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

.file-table tr { cursor: pointer; }

.file-name-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    flex-shrink: 0;
}

.file-icon.folder { background: #e8f0fe; color: #4285f4; }
.file-icon.image { background: #fce8e6; color: #ea4335; }
.file-icon.video { background: #fce8e6; color: #ea4335; }
.file-icon.audio { background: #fef7e0; color: #f9ab00; }
.file-icon.pdf { background: #fce8e6; color: #ea4335; }
.file-icon.document { background: #e8f0fe; color: #4285f4; }
.file-icon.spreadsheet { background: #e6f4ea; color: #34a853; }
.file-icon.presentation { background: #fef7e0; color: #f9ab00; }
.file-icon.archive { background: #f3e8fd; color: #a142f4; }
.file-icon.text { background: #e8eaed; color: #5f6368; }
.file-icon.code { background: #e8eaed; color: #5f6368; }
.file-icon.file { background: #e8eaed; color: #5f6368; }

.file-icon svg {
    width: 18px;
    height: 18px;
}

/* AUTO-DELETE COLUMN */
.col-expires {
    font-size: 13px;
}

.delete-date {
    color: var(--text-secondary);
    display: block;
    line-height: 1.3;
}

.delete-countdown {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--hover);
    padding: 1px 6px;
    border-radius: 3px;
    margin-top: 2px;
}

.delete-countdown.expires-soon {
    color: #fff;
    background: var(--danger);
}

.expires-never {
    color: var(--text-secondary);
    opacity: 0.5;
    font-style: italic;
}

.file-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.file-table tr:hover .file-actions {
    opacity: 1;
}

.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 80px;
    height: 80px;
    color: var(--border);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text);
}

/* MODAL */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

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

.modal {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 24px;
    width: 100%;
    max-width: 420px;
    margin: 20px;
    transform: scale(0.95);
    transition: transform 0.2s;
}

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

.modal h2 {
    font-size: 18px;
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

/* LOADING */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* TOAST */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: #323232;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .app-header { padding: 0 16px; }
    .main-content { padding: 16px; }
    .user-info { display: none; }
    .upload-zone { padding: 24px 16px; }
    .file-table .col-size,
    .file-table .col-date,
    .file-table .col-expires { display: none; }
    .toolbar { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    .login-card { padding: 32px 24px; }
}

/* ADMIN DASHBOARD */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.admin-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.user-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    font-weight: 500;
    font-size: 14px;
}

.user-email {
    font-size: 12px;
    color: var(--text-secondary);
}

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-admin {
    background: #e8f0fe;
    color: #1a73e8;
}

.badge-user {
    background: #e8eaed;
    color: #5f6368;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-dot.active { background: var(--success); }
.status-dot.inactive { background: var(--danger); }

.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    background: var(--surface);
    cursor: pointer;
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.folder-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding: 4px 0;
}

.folder-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.folder-check:hover {
    background: var(--hover);
}

.folder-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.folder-check-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.modal.wide {
    max-width: 560px;
}

.expiry-input {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    outline: none;
}

.expiry-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}
