*{
    margin:0;
    padding:0;
    font-family: Arial, Helvetica, sans-serif;
}

/* Sidebar */

.sidebar{
    position:fixed;
    left:0;
    top:0;
    width:250px;
    height:100%;
    background:#25303b;
    padding-top:20px;
    box-shadow: 4px 0 10px rgba(0,0,0,0.5);
    /*4px deslocamento horizontal (horizontal offset) */
    /*0 deslocamento vertical (vertical offset) */
    /*10px blur radius → quão suave/desfocada fica a sombra */
    /*rgba(0,0,0,0.2); cor da sombra + transparência */
}

.storage{
    padding-left:0px 20px;
    margin-top: 20px;

}

.storage .progress{
    width: 80%;
    height: 8px;
    margin-left: auto;
    margin-right:auto;
}

/* Logo */

.logo{
    color:rgb(255, 255, 255);
    text-align:center;
    margin-bottom:30px;
}

/* Menu */
.menu{
    list-style:none;
    padding-left: 0;
    margin:0;
}

.menu li{
    margin:5px 0;
    align-items: center;
    display: block;
}

.menu a{
    display:block;
    padding:15px 20px;
    color:white;
    text-decoration:none;
    transition:0.3s;
}

/* Hover */

.menu a:hover{
    background:#34495e;
    padding-left:30px;
}

/* Conteúdo principal */

.imagem_side_bar{
    width:20px;
    height:20px;
    margin-right:10px;
}

.separador_side{
    margin: 5px; 
    border-color: rgb(27, 32, 58);
    color: rgb(27, 32, 58);
}

.barra_espaco{
    background-color: rgb(120, 139, 230);
    border-color: rgb(120, 139, 230);
}



/* Main Page */

main {
    margin-left: 300px;
    padding: 20px;
    box-sizing: border-box;
}

.container_search {
    width: 100%;
    margin-top: 30px;
    padding-left: 12px;
    padding-right: 12px;
    box-sizing: border-box;
}

.search_box {
    margin: 0;
}

.search_box input {
    width: 100%;
    padding: 10px 16px;
    border-radius: 30px;
    border: 1px solid #ccc;
}

.button_add_files {
    padding: 10px 24px;
    border-radius: 30px;
    
}

.container_main{ 
    width: 100%;
    margin-top: 30px;
    padding-left: 12px;
    padding-right: 12px;
    box-sizing: border-box;
}

/* Caixa de ficheiro em formato de card */
.container_main .caixa{ 
    width: 100%;
    height: 100%;
    box-shadow: 0px 10px 13px -7px #000000;
    padding: 5px;
    border-radius: 2%;
    border-top-right-radius: 7%;
    display: block;
    justify-content: center;
    align-items: center;
}

/* Área do nome do ficheiro dentro da caixa */
.caixa .nome_ficheiro{
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 8px 12px;
}

.caixa .img_ficheiro{
    width: 100%;
    max-width: 120px;
    height: auto;
    display: block;
    margin: auto;
}


/* -------------------- FILES.HTML -------------------- */
/* para deixar tudo na horizontal, ficheiro files.html */

/* Ícone do ficheiro */
.file-name img {
    width: 40px;
    height: 70px;
    object-fit: contain;
}

/* Cada linha de ficheiro */
.file-row{
    display: flex;
    align-items: center;
    gap: 30px;
    padding: 15px 0;
    border-bottom: 1px solid #ccc;
}

/* Bloco que junta ícone + nome do ficheiro */
.file-name{
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 350px;
}

/* Ajuste do tamanho da imagem do ficheiro */
.file-name img{
    width: 40px;
    height: 40px;
    object-fit: contain;
}

/* Data do ficheiro */
.file-date{
    min-width: 220px;
}

/* Localização do ficheiro */
.file-location{
    min-width: 150px;
}

/* Botão dos 3 pontinhos */
.file-menu{
    font-size: 22px;
    cursor: pointer;
}

/* Barra superior com título à esquerda e botões à direita */
.top-bar{
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Link/botão View more */
.view-more a{
    display: inline-block;
    padding: 10px 18px;
    margin-top: 20px;
    border-radius: 8px;
    background-color: white;
    color: #4d64c1;
    text-decoration: none;
    font-weight: 500;
    transition: 0.2s;
}

/* Hover do botão View more */
.view-more a:hover{
    background-color: #f5f7fb;
    border: 1px solid #d6d6d6;
    border-color: #b7c7ff;
}


/* -------------------- MENU DROPDOWN DOS 3 PONTINHOS -------------------- */
/* Container do botão dos 3 pontinhos */
.file-menu-container{
    position: relative;
    display: inline-block;
}

/* Menu escondido por padrão */
.menu-dropdown{
    display: none;
    position: absolute;
    top: 35px;
    right: 0;
    background: white;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    min-width: 150px;
    box-shadow: 0px 4px 12px rgba(0,0,0,0.15);
    overflow: hidden;
    z-index: 100;
}

/* Quando o JS adiciona a classe show, o menu aparece */
.menu-dropdown.show{
    display: block;
}

.menu-item{
    padding: 10px 14px;
    padding-left: 18px; /* espaço antes do texto */
    font-size: 14px;
    cursor: pointer;
}

.menu-item:hover{
    background-color: #f5f7fb;
}

/* -------------------- MODAL DE UPLOAD -------------------- */

/* Área de Drag and Drop */
#dropZone {
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    border: 2px dashed #ccc !important;
    background-color: transparent;
}

#dropZone:hover {
    border-color: #0d6efd !important;
    background-color: #f0f7ff;
}

#dropZone.dragover {
    border-color: #0d6efd !important;
    background-color: #f0f7ff;
    box-shadow: 0 0 10px rgba(13, 110, 253, 0.25);
}

#dropZone svg {
    color: #0d6efd;
    margin-bottom: 10px;
}

#dropZone p {
    margin: 0;
}

/* Lista de ficheiros */
#fileItems {
    max-height: 300px;
    overflow-y: auto;
}

#fileItems .list-group-item {
    border: 1px solid #e2e2e2;
    padding: 12px;
}

#fileItems .list-group-item:hover {
    background-color: #f8f9fa;
}

#fileItems .list-group-item strong {
    color: #333;
    word-break: break-word;
}

#fileItems .text-muted {
    font-size: 0.85rem;
}

/* Botão de envio */
#uploadBtn {
    min-width: 120px;
}

#uploadBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Ocultando o input de ficheiro */
#fileInput {
    display: none;
}

/* Modal header e footer */
.modal-header {
    border-bottom: 1px solid #e2e2e2;
}

.modal-footer {
    border-top: 1px solid #e2e2e2;
}
/* ─── Vista em lista ──────────────────────────────────────────────────── */
.files-list-view {
    width: 100%;
}

.file-list-header,
.file-list-row {
    display: grid;
    grid-template-columns: 1fr 110px 160px 200px;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
}

.file-list-header {
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    font-size: 0.82rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.file-list-row {
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.file-list-row:hover {
    background-color: #f8f9fa;
}

.fli-name {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0; /* permite text-truncate funcionar */
}

.fli-name img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}

.fli-actions {
    justify-content: flex-end;
}
/* ──────────────────────────────────────────────────────────────────────── */
/* -------------------- DRIVE NA SIDEBAR -------------------- */
.drive-sidebar-actions {
    margin-top: -4px;
}

.sidebar-folder-tree {
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.sidebar-folder-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.sidebar-folder-list ul {
    list-style: none;
    padding-left: 14px;
    margin: 2px 0 0 0;
    border-left: 1px solid rgba(255,255,255,0.12);
}

.sidebar-folder-item {
    margin: 2px 0;
}

.sidebar-folder-btn {
    width: 100%;
    border: 0;
    background: transparent;
    color: rgba(255,255,255,0.86);
    text-align: left;
    padding: 7px 8px;
    border-radius: 8px;
    display: flex;
    gap: 7px;
    align-items: center;
    font-size: 0.92rem;
}

.sidebar-folder-btn:hover {
    background: #34495e;
    color: white;
}

.sidebar-folder-btn.active {
    background: rgba(120, 139, 230, 0.35);
    color: white;
    font-weight: 600;
}

.sidebar-folder-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-card {
    background: #fff;
}

.folder-hidden-in-main-note {
    font-size: 0.9rem;
}

/* ─── Temas e definições ─────────────────────────────────────────────── */
:root {
    --app-bg: #f7f8fb;
    --app-surface: #ffffff;
    --app-surface-soft: #f8f9fa;
    --app-text: #111827;
    --app-muted: #6c757d;
    --app-border: #dee2e6;
    --sidebar-bg: #25303b;
    --sidebar-text: #f8fafc;
    --sidebar-muted: #cbd5e1;
    --sidebar-hover: #34495e;
    --sidebar-active: rgba(120, 139, 230, 0.38);
    --card-shadow: 0 10px 18px rgba(15, 23, 42, 0.12);
}

html[data-app-theme="dark"] {
    --app-bg: #0f172a;
    --app-surface: #111827;
    --app-surface-soft: #1f2937;
    --app-text: #e5e7eb;
    --app-muted: #a7b0c0;
    --app-border: #334155;
    --sidebar-bg: #111827;
    --sidebar-text: #f8fafc;
    --sidebar-muted: #cbd5e1;
    --sidebar-hover: #1f2937;
    --sidebar-active: rgba(120, 139, 230, 0.5);
    --card-shadow: 0 12px 24px rgba(0, 0, 0, 0.45);
}

body {
    background: var(--app-bg);
    color: var(--app-text);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar {
    background: var(--sidebar-bg) !important;
}

.logo,
.menu a,
.menu a:visited,
.menu a:focus,
.drive-sidebar-link,
.sidebar-main-link {
    color: var(--sidebar-text) !important;
}

.menu a:hover,
.menu a.active,
.sidebar-main-link.active {
    background: var(--sidebar-hover);
    color: #ffffff !important;
}

.sidebar-main-link.active {
    font-weight: 700;
    border-left: 4px solid rgb(120, 139, 230);
    padding-left: 16px;
}

.sidebar-muted,
.sidebar .text-muted,
.storage .text-muted {
    color: var(--sidebar-muted) !important;
}

.sidebar .btn-outline-light {
    color: var(--sidebar-text);
    border-color: rgba(255,255,255,0.45);
}

.sidebar .btn-outline-light:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.sidebar-folder-btn {
    color: var(--sidebar-text) !important;
}

.sidebar-folder-btn:hover {
    background: var(--sidebar-hover);
    color: #ffffff !important;
}

.sidebar-folder-btn.active {
    background: var(--sidebar-active);
    color: #ffffff !important;
}

.separador_side {
    border-color: rgba(255,255,255,0.18);
}

.container_main .caixa,
.file-card,
.settings-card,
.theme-preview,
.preview-file-row {
    background: var(--app-surface);
    color: var(--app-text);
    border: 1px solid var(--app-border);
    box-shadow: var(--card-shadow);
}

.caixa .nome_ficheiro,
#driveTitle,
.settings-page h2,
.settings-page h5,
.table,
.table td,
.table th {
    color: var(--app-text);
}

.text-muted,
.caixa .text-muted,
.table .text-muted {
    color: var(--app-muted) !important;
}

.search_box input,
.form-control,
.form-select {
    background-color: var(--app-surface);
    color: var(--app-text);
    border-color: var(--app-border);
}

.search_box input::placeholder,
.form-control::placeholder {
    color: var(--app-muted);
}

.container_filters .btn,
#folderBreadcrumb a {
    color: var(--app-text);
}

html[data-app-theme="dark"] .alert-light {
    background-color: var(--app-surface-soft);
    border-color: var(--app-border) !important;
    color: var(--app-muted) !important;
}

html[data-app-theme="dark"] .table-light,
html[data-app-theme="dark"] .table-light th {
    background-color: var(--app-surface-soft);
    color: var(--app-text);
    border-color: var(--app-border);
}

html[data-app-theme="dark"] .table-hover > tbody > tr:hover > * {
    --bs-table-bg-state: #1f2937;
    color: var(--app-text);
}

html[data-app-theme="dark"] #dropZone:hover,
html[data-app-theme="dark"] #dropZone.dragover {
    background-color: rgba(13, 110, 253, 0.12);
}

html[data-app-theme="dark"] #fileItems .list-group-item:hover,
html[data-app-theme="dark"] .file-list-row:hover {
    background-color: var(--app-surface-soft);
}

.app-view {
    animation: viewFadeIn 0.12s ease-in-out;
}

.settings-view {
    width: 100%;
    margin-top: 30px;
    padding-left: 12px;
    padding-right: 12px;
    box-sizing: border-box;
}

.settings-page {
    max-width: 920px;
}

.theme-toggle-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-end;
}

.theme-preview {
    box-shadow: none;
}

.preview-file-row {
    box-shadow: none;
}

@keyframes viewFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Ajustes finais da sidebar: só uma opção ativa e sem árvore de pastas */
.sidebar .menu a.sidebar-main-link {
    color: var(--sidebar-text) !important;
    border-left: 4px solid transparent;
    box-sizing: border-box;
}

.sidebar .menu a.sidebar-main-link:hover {
    background: var(--sidebar-hover);
    color: #ffffff !important;
    padding-left: 20px;
}

.sidebar .menu a.sidebar-main-link.active {
    background: var(--sidebar-active);
    color: #ffffff !important;
    font-weight: 700;
    border-left-color: rgb(120, 139, 230);
    padding-left: 16px;
}

.sidebar .menu a.sidebar-main-link:not(.active) {
    background: transparent;
}

/* Pastas na área principal da Drive */
.folder-card {
    text-transform: none !important;
    letter-spacing: normal !important;
}

.folder-open-btn {
    border: 0;
    background: transparent;
    color: var(--app-text);
    padding: 16px 16px 10px 16px;
    border-radius: 10px;
}

.folder-open-btn:hover,
.folder-open-btn:focus {
    background: var(--app-surface-soft);
    outline: none;
}

.folder-icon {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: 12px;
}

.folder-name {
    font-weight: 700;
    color: var(--app-text);
}

.folder-row-btn {
    border: 0;
    background: transparent;
    color: var(--app-text);
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 0;
    font-weight: 600;
}

.folder-row-btn:hover,
.folder-row-btn:focus {
    color: var(--bs-primary);
    text-decoration: underline;
}

/* ─── Ajustes finais da sidebar e separação Início/Drive ─────────────── */
.imagem_side_bar {
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

.sidebar-main-link,
.sidebar-main-link:visited,
.sidebar-main-link:focus {
    color: #ffffff !important;
}

.sidebar-main-link.active .imagem_side_bar,
.sidebar-main-link:hover .imagem_side_bar {
    filter: brightness(0) invert(1);
    opacity: 1;
}

.folder-card .folder-open-btn,
.folder-row-btn {
    border: 0;
    background: transparent;
    color: inherit;
}

.folder-card .folder-open-btn {
    padding: 16px 18px 10px 18px;
}

.folder-card .folder-icon {
    font-size: 2rem;
    line-height: 1;
    margin-bottom: 12px;
}

.folder-card .folder-name {
    font-weight: 700;
    font-size: 1rem;
}

.folder-row-btn {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
}


/* ─── MFA / Definições ─────────────────────────────────────────────── */
#mfaSettingsAlert .alert {
    margin-bottom: 1rem;
}

#mfaStatusBadge {
    font-size: 0.85rem;
    padding: 0.55rem 0.8rem;
}

#mfaRecoveryKeyInput {
    resize: vertical;
}

/* ─── Responsivo — Mobile ────────────────────────────────────────────────── */

/* Botão hamburger — só visível em mobile */
#hamburgerBtn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1060;
    background: #25303b;
    border: none;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
}

#hamburgerBtn span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: 0.3s;
}

/* Overlay escuro atrás da sidebar em mobile */
#sidebarOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1040;
}

#sidebarOverlay.show {
    display: block;
}

@media (max-width: 767.98px) {

    /* Sidebar escondida por defeito em mobile */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1050;
    }

    /* Sidebar aberta quando tem a classe .sidebar-open */
    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    /* Conteúdo principal ocupa o ecrã todo */
    main {
        margin-left: 0 !important;
        padding: 16px !important;
        padding-top: 60px !important; /* espaço para o hamburger */
    }

    /* Botão hamburger visível */
    #hamburgerBtn {
        display: flex;
    }

    /* Barra de pesquisa e botão Adicionar em coluna */
    .container_search .row {
        flex-direction: column;
        gap: 10px;
    }

    .container_search .col-md-6 {
        width: 100%;
    }

    .button_add_files {
        width: 100%;
        text-align: center;
    }

    /* Cards de ficheiros — 1 por linha em mobile */
    .col-sm-6,
    .col-md-4,
    .col-lg-3 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }

    /* Tabela em lista — esconder colunas menos importantes */
    .table th:nth-child(2),
    .table td:nth-child(2),
    .table th:nth-child(3),
    .table td:nth-child(3) {
        display: none;
    }

    /* Página de definições */
    .settings-page {
        max-width: 100%;
    }

    /* Settings — cabeçalho */
    .settings-header h2 {
        font-size: 1.4rem;
    }

    /* Settings — cards com padding reduzido */
    .settings-card .card-body {
        padding: 1rem !important;
    }

    /* Tema — botões ficam em linha abaixo do texto */
    .theme-toggle-group {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    /* MFA — colunas col-lg-4 ficam todas a 100% */
    .settings-card .col-lg-4,
    .settings-card .col-lg-8 {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* Recovery key textarea — altura menor em mobile */
    #mfaRecoveryKeyInput {
        min-height: 70px;
    }

    /* Separador hr — menos margem */
    .settings-card hr.my-4 {
        margin-top: 1rem !important;
        margin-bottom: 1rem !important;
    }
}

@media (min-width: 768px) {
    /* Em desktop a sidebar está sempre visível */
    .sidebar {
        transform: translateX(0) !important;
    }

    #sidebarOverlay {
        display: none !important;
    }
}
/* ──────────────────────────────────────────────────────────────────────────── */