/* =========================================================
   ORQUESTRA CDE - CENTRAL DE PROJETOS (GITEA INTEGRATION)
   ========================================================= */

/* Container Principal do CDE */
.cde-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 10px 0 40px 0;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* Header & Banner Superior */
.cde-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 16px;
    padding: 24px 30px;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    overflow: hidden;
}

.cde-header::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0) 70%);
    pointer-events: none;
}

.cde-header-left {
    display: flex;
    align-items: center;
    gap: 18px;
    z-index: 1;
}

.cde-header-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: #60a5fa;
}

.cde-header-title h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #f8fafc;
}

.cde-header-title p {
    margin: 4px 0 0 0;
    font-size: 0.85rem;
    color: #94a3b8;
}

.cde-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1;
}

/* Seletor de Repositório do CDE */
.cde-repo-badge {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: #cbd5e1;
}

.cde-repo-badge select {
    background: transparent;
    border: none;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

.cde-repo-badge select option {
    background: #1e293b;
    color: #ffffff;
}

/* Barra de Filtros e Busca */
.cde-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    background: #ffffff;
    padding: 16px 20px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.cde-search-box {
    position: relative;
    flex: 1;
    min-width: 260px;
    max-width: 450px;
}

.cde-search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.9rem;
}

.cde-search-box input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 0.88rem;
    outline: none;
    transition: all 0.2s;
    background: #f8fafc;
}

.cde-search-box input:focus {
    background: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.cde-filter-pills {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cde-pill {
    padding: 7px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid transparent;
    transition: all 0.2s;
    user-select: none;
}

.cde-pill:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.cde-pill.active {
    background: #3b82f6;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.cde-pill-badge {
    background: rgba(0, 0, 0, 0.15);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    margin-left: 4px;
}

/* Layout Principal: Disciplinas + Grade de Arquivos */
.cde-main-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 1024px) {
    .cde-main-layout {
        grid-template-columns: 1fr;
    }
}

/* Barra Lateral de Disciplinas */
.cde-disciplines-sidebar {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cde-sidebar-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    padding: 6px 12px 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cde-discipline-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.18s ease;
    border: 1px solid transparent;
}

.cde-discipline-item:hover {
    background: #f8fafc;
    border-color: #e2e8f0;
    transform: translateX(2px);
}

.cde-discipline-item.active {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.cde-discipline-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cde-disc-badge {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.72rem;
    flex-shrink: 0;
}

.cde-disc-name {
    font-size: 0.86rem;
    font-weight: 600;
    color: #334155;
}

.cde-discipline-item.active .cde-disc-name {
    color: #1d4ed8;
}

.cde-disc-count {
    font-size: 0.75rem;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.cde-discipline-item.active .cde-disc-count {
    background: #dbeafe;
    color: #1e40af;
}

/* Cores padronizadas de disciplinas */
.disc-arq { background: #e0f2fe; color: #0284c7; }
.disc-est { background: #fee2e2; color: #dc2626; }
.disc-ele { background: #fef3c7; color: #d97706; }
.disc-hid { background: #cffafe; color: #0891b2; }
.disc-san { background: #e0e7ff; color: #4338ca; }
.disc-psg { background: #dcfce7; color: #16a34a; }
.disc-sdg { background: #f1f5f9; color: #475569; }
.disc-tel { background: #fae8ff; color: #a21caf; }
.disc-tpg { background: #ffedd5; color: #c2410c; }
.disc-tpl { background: #fef9c3; color: #854d0e; }
.disc-default { background: #f1f5f9; color: #64748b; }

/* Conteúdo Direito: Cabeçalho da Disciplina e Grid de Arquivos */
.cde-content-area {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cde-view-header {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.cde-view-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cde-view-header-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.cde-view-header-subtitle {
    font-size: 0.8rem;
    color: #64748b;
    margin: 2px 0 0 0;
}

.cde-type-tabs {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
    gap: 4px;
}

.cde-view-switcher {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
    gap: 4px;
}

.cde-view-btn {
    padding: 6px 10px;
    border-radius: 7px;
    font-size: 0.82rem;
    color: #64748b;
    cursor: pointer;
    border: none;
    background: transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cde-view-btn:hover {
    color: #1e293b;
}

.cde-view-btn.active {
    background: #ffffff;
    color: #3b82f6;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Modo Tabela / Lista */
.cde-table-container {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    overflow-x: auto;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.cde-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.84rem;
}

.cde-table thead tr {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.cde-table th {
    padding: 12px 16px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    white-space: nowrap;
}

.cde-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s ease;
}

.cde-table tbody tr:hover {
    background: #f8fafc;
}

.cde-table td {
    padding: 12px 16px;
    color: #334155;
    vertical-align: middle;
}

.cde-table-file-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #1e293b;
}

.cde-table-file-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.cde-table-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
}

.cde-table-actions .cde-btn-action {
    padding: 5px 10px;
    font-size: 0.74rem;
    border-radius: 6px;
    height: 30px;
}

.cde-type-tab {
    padding: 6px 14px;
    border-radius: 7px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border: none;
    background: transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cde-type-tab:hover {
    color: #1e293b;
}

.cde-type-tab.active {
    background: #ffffff;
    color: #1e293b;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Grid de Arquivos e Pranchas */
.cde-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 16px;
}

.cde-file-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    position: relative;
    overflow: hidden;
}

.cde-file-card:hover {
    border-color: #cbd5e1;
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

/* Área de thumbnail (topo do card) */
.cde-pdf-thumb-area {
    width: 100%;
    height: 160px;
    background: #f1f5f9;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
}

.cde-pdf-thumb-area canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease;
}

.cde-file-card:hover .cde-pdf-thumb-area canvas {
    transform: scale(1.03);
}

.cde-pdf-thumb-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #cbd5e1;
}

.cde-pdf-thumb-placeholder i {
    font-size: 2.5rem;
    opacity: 0.6;
}

.cde-pdf-thumb-placeholder span {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.cde-pdf-thumb-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #94a3b8;
    font-size: 0.78rem;
}

.cde-pdf-thumb-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: cde-spin 0.8s linear infinite;
}

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

/* Badge de tipo sobre a thumbnail */
.cde-thumb-type-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
}

.cde-thumb-type-pdf  { background: rgba(220, 38, 38, 0.9); color: white; }
.cde-thumb-type-ifc  { background: rgba(37, 99, 235, 0.9); color: white; }
.cde-thumb-type-dwg  { background: rgba(217, 119, 6, 0.9);  color: white; }
.cde-thumb-type-other{ background: rgba(71, 85, 105, 0.85); color: white; }

/* Área de info e ações (parte inferior do card) */
.cde-file-card-body {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.cde-file-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.cde-file-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.file-icon-pdf { background: #fee2e2; color: #dc2626; }
.file-icon-ifc { background: #dbeafe; color: #2563eb; }
.file-icon-dwg { background: #fef3c7; color: #d97706; }
.file-icon-generic { background: #f1f5f9; color: #64748b; }

.cde-file-details {
    flex: 1;
    min-width: 0;
}

.cde-file-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    text-decoration: none;
}

.cde-file-meta {
    font-size: 0.74rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cde-file-tag {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    background: #f1f5f9;
    color: #475569;
}

.cde-file-commit-info {
    font-size: 0.73rem;
    color: #64748b;
    margin: 10px 0 14px 0;
    padding: 8px 10px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cde-file-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.cde-btn-action {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #334155;
    transition: all 0.15s;
}

.cde-btn-action:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

.cde-btn-primary {
    background: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

.cde-btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

/* Empty State / Loading */
.cde-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    color: #94a3b8;
}

.cde-empty-state i {
    font-size: 2.5rem;
    color: #cbd5e1;
    margin-bottom: 14px;
    display: block;
}

.cde-empty-state h4 {
    color: #475569;
    margin: 0 0 6px 0;
    font-size: 1.05rem;
}

.cde-empty-state p {
    font-size: 0.85rem;
    margin: 0;
}

/* Modal de Visualização de Prancha PDF em Tela Cheia */
.cde-modal-pdf {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.cde-modal-pdf.active {
    display: flex;
}

.cde-modal-pdf-content {
    background: #ffffff;
    width: 95vw;
    height: 92vh;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.cde-modal-pdf-header {
    background: #1e293b;
    padding: 14px 20px;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.cde-modal-pdf-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cde-modal-pdf-title h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #f8fafc;
}

.cde-modal-pdf-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cde-modal-pdf-controls button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.cde-modal-pdf-controls button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.cde-modal-pdf-body {
    flex: 1;
    background: #334155;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cde-modal-pdf-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #ffffff;
}

.cde-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 41, 59, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    gap: 14px;
    z-index: 10;
}

.cde-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: cdeSpin 0.8s linear infinite;
}

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