:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --bg-color: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --border-color: rgba(255, 255, 255, 0.5);
    --success-color: #10b981;
    --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --focus-ring: rgba(99, 102, 241, 0.4);
    
    --radius-md: 10px;
    --radius-lg: 16px;
    
    --glass-bg: rgba(255, 255, 255, 0.55);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    line-height: 1.5;
    padding: 20px;
    -webkit-font-smoothing: antialiased;
    background: linear-gradient(-45deg, #e0c3fc, #8ec5fc, #a1c4fd, #c2e9fb);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    min-height: 100vh;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header-icon {
    margin-bottom: -10px;
}

header h1 {
    font-size: 2.3rem;
    font-weight: 800;
    color: var(--text-primary);
    text-shadow: 0px 4px 10px rgba(0,0,0,0.1);
    margin-bottom: 0.5rem;
    z-index: 1;
}

header p {
    color: rgba(30, 41, 59, 0.8);
    font-size: 1.1rem;
    font-weight: 600;
}

.card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--glass-shadow);
    border: 1px solid var(--glass-border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.15);
    transform: translateY(-2px);
}

.card h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    border-bottom: 2px solid rgba(255,255,255,0.5);
    padding-bottom: 0.5rem;
    font-weight: 700;
}

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

.project-card .form-group,
.full-width {
    grid-column: 1 / -1;
}

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

label {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

input, select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

input:focus, select:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 0 0 3px var(--focus-ring), inset 0 2px 4px rgba(0,0,0,0.02);
    background-color: rgba(255,255,255,0.9);
}

.input-with-select {
    display: flex;
    gap: 0.5rem;
}

.input-with-select input {
    flex: 2;
}

.input-with-select select {
    flex: 1;
}

.readonly-metrics {
    background: rgba(255, 255, 255, 0.4);
}

.readonly {
    background-color: rgba(241, 245, 249, 0.5);
    color: var(--text-secondary);
    border-color: transparent;
    font-weight: 700;
    cursor: default;
}

.actions {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success-gradient);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.5);
}

.btn-icon {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(4px);
    border: 1px solid var(--glass-border);
    padding: 0 1rem;
    height: 40px;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-primary);
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    width: 120px;
    box-sizing: border-box;
    margin: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 2px solid rgba(255,255,255,0.5);
    padding-bottom: 0.5rem;
}

.project-header h2 {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.project-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Tabela Quadro de Cargas */
.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.5);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}

th:last-child, td:last-child {
    white-space: nowrap;
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.4);
    font-size: 0.9rem;
}

th {
    background-color: rgba(255, 255, 255, 0.6);
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

tbody tr {
    transition: background-color 0.2s;
}

tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.8);
}

/* Coluna de Ação Fixa (Sticky) */
th:last-child, 
td:last-child {
    position: sticky;
    right: 0;
    z-index: 10;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    box-shadow: -4px 0 8px rgba(0, 0, 0, 0.05);
    min-width: 120px;
}

th:last-child {
    background-color: rgba(241, 245, 249, 0.95);
    z-index: 11;
}

tbody tr:hover td:last-child {
    background-color: rgba(255, 255, 255, 1);
}

.btn-delete {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 1.1rem;
    transition: transform 0.2s;
    padding: 0.25rem 0.5rem;
}

.btn-delete:hover {
    transform: scale(1.2);
}

.btn-edit {
    background: transparent;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 1.1rem;
    transition: transform 0.2s;
    padding: 0.25rem 0.5rem;
}

.btn-edit:hover {
    transform: scale(1.2);
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-style: italic;
    background: rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-md);
    margin-top: 1rem;
}

.label-with-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.label-with-button label {
    margin-bottom: 0;
}

.btn-info {
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.4);
}

.btn-info:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.6);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    margin: auto;
    padding: 2rem 1rem 1rem 1rem;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 1000px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    animation: modalIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-40px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.btn-close {
    position: absolute;
    top: 10px;
    right: 15px;
    color: var(--text-secondary);
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
}

.btn-close:hover {
    color: #ef4444;
    transform: scale(1.1);
}

.modal-img-container {
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: var(--radius-md);
}

.modal-img-container img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
}

.hidden {
    display: none !important;
}

.result-card {
    border: 2px solid rgba(16, 185, 129, 0.4);
    background-color: rgba(240, 253, 244, 0.7);
}

.result-card h2 {
    color: #059669;
    border-bottom-color: rgba(16, 185, 129, 0.3);
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.result-box {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(16, 185, 129, 0.3);
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.result-box h3 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.result-box p {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
}

.final-result-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px dashed rgba(16, 185, 129, 0.5);
}

.final-result {
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 2px solid rgba(16, 185, 129, 0.5);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.15);
}

.disjuntor-result {
    border-color: rgba(59, 130, 246, 0.5); /* Azul */
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.15);
}

.disjuntor-result h3 {
    color: #2563eb;
}

.disjuntor-result .highlight-value {
    color: #3b82f6;
    text-shadow: 0px 2px 4px rgba(59, 130, 246, 0.2);
}

.highlight-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--success-color);
    margin: 0.5rem 0;
    text-shadow: 0px 2px 4px rgba(16, 185, 129, 0.2);
}

.highlight-value span {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: block;
    text-shadow: none;
}

#res-detalhes {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

@media (max-width: 600px) {
    .container {
        padding: 0;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .card {
        padding: 1.25rem;
        border-radius: var(--radius-lg);
        margin: 0.5rem 0;
        border-left: none;
        border-right: none;
    }
}

.site-footer {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.4);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(8px);
    box-shadow: 0 -4px 10px rgba(0,0,0,0.02);
}

.site-footer p {
    margin-bottom: 0.5rem;
}

.site-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 700;
}

.site-footer a:hover {
    text-decoration: underline;
    color: var(--primary-hover);
}

/* =========================================
   Sidebar / Menu Lateral
   ========================================= */
.menu-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.menu-toggle:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    z-index: 1002;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.15);
    transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}

.sidebar-header h3 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
}

.btn-close-menu {
    background: transparent;
    border: none;
    font-size: 2.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s, transform 0.2s;
}

.btn-close-menu:hover {
    color: #ef4444;
    transform: scale(1.1);
}

.sidebar-nav {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid transparent;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateX(5px);
    color: var(--primary-color);
}

.nav-link.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

/* Modal ICC Styles */
.modal-large {
    max-width: 600px;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.5);
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.modal-footer button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.icc-results {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.icc-result-box {
    background: rgba(255, 255, 255, 0.6);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.icc-result-box.highlight {
    background: var(--primary-gradient);
    color: white;
}

.icc-label {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.icc-value {
    font-size: 1.5rem;
    font-weight: 800;
}

/* Memorial de Cálculo Styles */
.memorial-body {
    max-height: 70vh;
    overflow-y: auto;
    padding: 2rem;
    background: #fff;
    color: #334155;
}

.memorial-section {
    margin-bottom: 2rem;
}

.memorial-section h3 {
    font-size: 1.25rem;
    color: #1e293b;
    margin-bottom: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.memorial-step {
    padding-left: 1.5rem;
    border-left: 3px solid #e2e8f0;
    margin-bottom: 1.5rem;
    transition: border-color 0.3s;
}

.memorial-step:hover {
    border-left-color: var(--primary-color);
}

.memorial-step h4 {
    font-size: 1rem;
    color: #475569;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.memorial-step p {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    color: #64748b;
}

.memorial-step strong {
    color: #0f172a;
}

.highlight-box {
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}
