:root {
    --bg-dark: #0f111a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --border-glass: rgba(255, 255, 255, 0.08);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Mesh / Gradients */
.background-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background: 
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.1), transparent 25%);
    filter: blur(60px);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.pulse-ring {
    width: 12px;
    height: 12px;
    background-color: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7);
    animation: pulse 2s infinite cubic-bezier(0.66, 0, 0, 1);
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -1px;
}

h1 span {
    color: var(--primary);
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Glass Panels */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
}

.upload-section { animation-delay: 0.2s; }
.data-section { animation-delay: 0.4s; }

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border-glass);
    border-radius: 16px;
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-icon {
    color: var(--primary);
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.drop-zone:hover .upload-icon {
    transform: translateY(-5px);
}

.drop-zone h2 {
    font-weight: 600;
    font-size: 1.5rem;
}

.drop-zone p {
    color: var(--text-muted);
}

/* Status Message */
.status-msg {
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 1rem;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-weight: 500;
}

.status-msg.hidden {
    display: none;
}

.status-msg.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-msg.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(99, 102, 241, 0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Table Section */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* Dashboard */
.dashboard-section { animation-delay: 0.3s; }
.dashboard-section h2 { margin-bottom: 1rem; font-size: 1.5rem; font-weight: 600; }

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.dash-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    transition: transform 0.3s ease;
}

.dash-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.06);
}

.dash-icon {
    font-size: 2rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
}

.pon-icon { background: rgba(245, 158, 11, 0.2); }
.cto-icon { background: rgba(236, 72, 153, 0.2); }
.clients-icon { background: rgba(16, 185, 129, 0.2); }
.splitters-icon { background: rgba(99, 102, 241, 0.2); }
.cable-icon { background: rgba(139, 92, 246, 0.2); }

.dash-info h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.2rem;
}

.dash-info p {
    font-size: 0.9rem;
    color: var(--text-muted);
}


.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Accordion / Hierarchical View */
.accordion-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

details {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

details[open] {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

summary {
    padding: 1.2rem 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 1.1rem;
    list-style: none; /* Hide default arrow */
    user-select: none;
    transition: background 0.2s ease;
}

summary:hover {
    background: rgba(255, 255, 255, 0.03);
}

summary::-webkit-details-marker {
    display: none;
}

.summary-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.summary-title svg {
    transition: transform 0.3s ease;
}

details[open] summary .summary-title svg {
    transform: rotate(90deg);
}

.summary-stats {
    font-size: 0.9rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
}

.details-content {
    padding: 0 1.5rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.item-row {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border-left: 3px solid transparent;
    transition: transform 0.2s ease, background 0.2s ease;
}

.item-row:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.05);
}

.item-row.cto { border-left-color: #f472b6; }
.item-row.backbone { border-left-color: #818cf8; }
.item-row.ramal { border-left-color: #34d399; }

.item-name {
    font-weight: 500;
    color: var(--text-main);
}

.item-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* Progress Bar & Materiais */
.progress-section { animation-delay: 0.1s; }
.materials-section { animation-delay: 0.2s; }

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.progress-header h2 { margin: 0; font-size: 1.5rem; }

.progress-percentage {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--success);
}

.progress-bar-container {
    width: 100%;
    height: 24px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 12px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.purchase-form {
    display: flex;
    gap: 1rem;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
}

.input-modern {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s ease;
    flex: 1;
}

.input-modern option {
    background: var(--bg-dark);
}

.input-modern:focus {
    border-color: var(--primary);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--border-glass);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

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

.item-row {
    align-items: center;
}

.item-actions {
    margin-left: auto;
}

.btn-install {
    background: var(--success);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-install:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

.btn-install:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    cursor: not-allowed;
}

.text-danger { color: var(--danger); font-weight: bold; }
.text-success { color: var(--success); font-weight: bold; }

.btn-success {
    background: var(--success);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

/* Modal Moderno */
dialog.modal-modern {
    margin: auto;
    padding: 0;
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    background: #1e2030;
    color: var(--text-main);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    width: 90%;
    max-width: 400px;
}

dialog.modal-modern::backdrop {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-glass);
}

.modal-header h3 { margin: 0; font-size: 1.2rem; }

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover { color: var(--danger); }

.modal-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-group select, .form-group input {
    width: 100%;
}

.hidden { display: none !important; }

/* Animations */
@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes pulse {
    to { box-shadow: 0 0 0 15px rgba(99, 102, 241, 0); }
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
/* Diagrama de Fusão Visual */
.diagram-container {
    min-width: 500px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 40px;
}

.diagram-node {
    padding: 12px 20px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    position: relative;
    z-index: 2;
    min-width: 100px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.node-olt {
    background: #0ea5e9;
    border: 2px solid #38bdf8;
}

.node-pon {
    width: 0;
    height: 0;
    border-left: 40px solid transparent;
    border-right: 40px solid transparent;
    border-top: 60px solid var(--primary);
    background: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    box-shadow: none;
    position: relative;
}

.node-pon span {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
}

.node-cto {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    padding: 8px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.node-cto i {
    width: 12px;
    height: 12px;
    background: var(--success);
    border-radius: 2px;
}

.diagram-branches {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.connection-line {
    position: absolute;
    z-index: 1;
    background: var(--border-glass);
    height: 2px;
}

.abnt-line {
    height: 3px;
    border-radius: 2px;
}

/* Cores ABNT */
.abnt-verde { background-color: #10b981; }
.abnt-amarelo { background-color: #facc15; }
.abnt-branco { background-color: #ffffff; }
.abnt-azul { background-color: #3b82f6; }
.abnt-vermelho { background-color: #ef4444; }
.abnt-violeta { background-color: #8b5cf6; }
.abnt-marrom { background-color: #92400e; }
.abnt-rosa { background-color: #f472b6; }
.abnt-preto { background-color: #000000; border: 1px solid #444; }
.abnt-cinza { background-color: #64748b; }
.abnt-laranja { background-color: #f97316; }
.abnt-aqua { background-color: #06b6d4; }
