/* ============================================
   RESET E BASE
   ============================================ */
* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    max-width: 1400px;
    margin: auto;
    padding: 15px;
    background: #f0f2f5;
    color: #333;
}

/* ============================================
   CONTAINERS E MENSAGENS
   ============================================ */
.container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.error {
    color: #c62828;
    background: #ffebee;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    border-left: 4px solid #c62828;
}
.error ul { margin: 5px 0; padding-left: 20px; }

.success {
    color: #2e7d32;
    background: #e8f5e9;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    border-left: 4px solid #2e7d32;
}

.info-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    background: #e3f2fd;
    color: #1976d2;
    font-size: 11px;
    margin-left: 5px;
    vertical-align: middle;
}

/* ============================================
   TABS
   ============================================ */
.tab-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 12px;
    flex-wrap: wrap;
}

.tab-button {
    background: #e0e0e0;
    border: none;
    padding: 9px 16px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.2s;
}
.tab-button:hover { background: #d0d0d0; }
.tab-button.active { background: #1976d2; color: white; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================
   FORMULÁRIOS
   ============================================ */
.form-group { margin-bottom: 12px; }

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 13px;
}

input[type="text"],
input[type="url"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 9px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
}

textarea { resize: vertical; }

button,
input[type="submit"] {
    background: #1976d2;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}
button:hover,
input[type="submit"]:hover { background: #1565c0; }

/* ============================================
   BREADCRUMB
   ============================================ */
.breadcrumb {
    background: #f5f5f5;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 13px;
    word-break: break-all;
}
.breadcrumb a { color: #1976d2; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ============================================
   TOOLBAR
   ============================================ */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #ddd;
    align-items: center;
}
.toolbar form {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.toolbar input[type="text"] {
    width: 150px;
    padding: 6px 8px;
}
.toolbar .input-zip { width: 130px !important; }
.toolbar .input-dest { width: 130px !important; }

.search-box {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    width: 200px;
}

/* ============================================
   TABELA DE ARQUIVOS
   ============================================ */
.file-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 13px;
}
.file-table th {
    background: #1976d2;
    color: white;
    padding: 10px;
    text-align: left;
    font-size: 12px;
}
.file-table th a { color: white; text-decoration: none; }
.file-table th a:hover { text-decoration: underline; }
.file-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}
.file-table tr:hover { background: #f9f9f9; }
.file-table tr.selected { background: #e3f2fd; }

.empty-row {
    text-align: center;
    padding: 20px;
    color: #999;
}

.checkbox-cell { width: 30px; text-align: center; }

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.perms-code { font-size: 11px; }

.actions-cell { white-space: nowrap; }

/* ============================================
   BOTÕES DE AÇÃO
   ============================================ */
.action-btn {
    display: inline-block;
    padding: 4px 8px;
    margin: 0 2px;
    border-radius: 4px;
    font-size: 12px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    color: white;
    line-height: 1.4;
    transition: opacity 0.2s;
}
.action-btn:hover { opacity: 0.85; }

.btn-download { background: #4caf50; }
.btn-view     { background: #2196f3; }
.btn-edit     { background: #9c27b0; }
.btn-delete   { background: #f44336; }
.btn-mkdir    { background: #9c27b0; }
.btn-extract  { background: #ff5722; }
.btn-rename   { background: #ff9800; }
.btn-duplicate{ background: #607d8b; }
.btn-chmod    { background: #795548; }
.btn-copy     { background: #2196f3; }
.btn-move     { background: #ff9800; }
.btn-primary  { background: #1976d2; }
.btn-secondary{ background: #9e9e9e; }

.btn-lg { padding: 8px 14px; font-size: 13px; }

.inline-form { display: inline; }

/* ============================================
   BARRA DE SELEÇÃO
   ============================================ */
.selection-bar {
    background: #e3f2fd;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    display: none;
    border: 2px solid #1976d2;
    flex-wrap: wrap;
    gap: 8px;
}
.selection-bar.active {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.selection-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.select-all-row {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.select-all-row label { cursor: pointer; user-select: none; }

/* ============================================
   COPY PATH BTN
   ============================================ */
.copy-path-btn {
    cursor: pointer;
    color: #999;
    margin-left: 6px;
    font-size: 11px;
    transition: color 0.2s;
}
.copy-path-btn:hover { color: #1976d2; }

/* ============================================
   MODAIS
   ============================================ */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    overflow: auto;
}
.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 10px;
    max-width: 90%;
    max-height: 90vh;
    overflow: auto;
    min-width: 400px;
    position: relative;
}
.modal-content.wide { width: 90%; max-width: 1100px; }

.modal-close {
    position: absolute;
    top: 10px; right: 15px;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
}
.modal-close:hover { color: #333; background: none; }

.modal-footer {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
}
.modal-footer > span:first-child { margin-right: auto; }

/* ============================================
   EDITOR
   ============================================ */
.editor-container {
    display: flex;
    height: 65vh;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}

.line-numbers {
    background: #f5f5f5;
    color: #999;
    padding: 10px 8px;
    text-align: right;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.5;
    user-select: none;
    min-width: 50px;
    overflow: hidden;
    white-space: pre;
}

.editor-textarea {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    tab-size: 4;
}

.editor-info {
    font-size: 12px;
    color: #666;
}

/* ============================================
   IMAGEM
   ============================================ */
.image-preview {
    max-width: 100%;
    max-height: 70vh;
    display: block;
    margin: 10px auto;
}

/* ============================================
   ÁRVORE DE DIRETÓRIOS
   ============================================ */
.file-tree {
    list-style: none;
    padding-left: 15px;
    margin: 5px 0;
}
.file-tree li { padding: 3px 0; }

.file-tree .dir {
    cursor: pointer;
    font-weight: 600;
    user-select: none;
}
.file-tree .dir:hover { color: #1976d2; }

.file-tree a {
    color: #333;
    text-decoration: none;
    padding: 2px 6px;
    border-radius: 3px;
}
.file-tree a:hover { background: #e3f2fd; color: #1976d2; }

.tree-open-link { font-size: 11px; }

.tree-picker {
    max-height: 300px;
    overflow: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 10px;
}
.tree-root {
    cursor: pointer;
    padding: 5px;
    color: #1976d2;
}
.tree-root:hover { background: #e3f2fd; border-radius: 3px; }

.picker-selected {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}