:root {
    --color-primary: #00B5E2;
    /* Cyan Blue */
    --color-primary-hover: #009AC0;
    --color-dark: #252E3E;
    /* Dark Navy */
    --color-card: #2F3B52;
    /* Lighter Navy */
    --color-text-grey: #B0B8C6;
    --color-white: #ffffff;
    --color-success: #4CAF50;
    --color-danger: #ff4b4b;
    --border-radius: 4px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Exo 2', sans-serif;
    background-color: var(--color-dark);
    color: var(--color-white);
    height: 100vh;
    overflow-y: hidden;
    /* App-like feel */
}

/* Layout */
.app-container {
    display: flex;
    height: 100%;
}

.sidebar {
    width: 300px;
    background-color: var(--color-card);
    padding: 20px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    overflow-y: auto;
    flex-shrink: 0;
}

.main-content {
    flex-grow: 1;
    padding: 30px;
    overflow-y: auto;
    max-width: 1200px;
    margin: 0 auto;
}

/* Typography */
h1 {
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 20px;
    text-align: center;
}

h2 {
    font-weight: 600;
    margin-bottom: 20px;
}

h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--color-text-grey);
}

p {
    font-size: 0.9rem;
}

/* Utilities */
.hidden {
    display: none !important;
}

.row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.col {
    flex: 1;
}

.col-grow {
    flex-grow: 1;
}

.col-fixed {
    width: 200px;
    flex-shrink: 0;
}

/* Inputs */
input,
select {
    width: 100%;
    padding: 10px;
    background-color: var(--color-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 1rem;
}

input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

input:focus,
select:focus {
    outline: 2px solid var(--color-primary);
    border-color: transparent;
}

label {
    display: block;
    margin-bottom: 5px;
    color: var(--color-text-grey);
    font-size: 0.85rem;
}

/* Buttons */
button {
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius);
    padding: 10px 20px;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.primary-btn {
    background-color: var(--color-primary);
    color: white;
}

.primary-btn:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
}

.secondary-btn {
    background-color: transparent;
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
}

.secondary-btn:hover {
    background-color: var(--color-primary);
    color: white;
}

.danger-btn {
    background-color: rgba(255, 75, 75, 0.2);
    color: var(--color-danger);
    border: 1px solid var (--color-danger);
}

.danger-btn:hover {
    background-color: var(--color-danger);
    color: white;
}

.block-btn {
    width: 100%;
    margin-top: 15px;
    height: 3em;
    font-size: 1.1rem;
}

.small-btn {
    padding: 5px 10px;
    font-size: 0.85rem;
}

/* Cards */
.card {
    background-color: rgba(255, 255, 255, 0.03);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
}

/* Calculator Specifics */
.calc-row {
    align-items: flex-end;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
    padding-bottom: 5px;
}

.col-item {
    flex: 2.5;
}

.col-unit {
    flex: 0.8;
}

.col-size {
    flex: 1.2;
}

.col-qty {
    flex: 0.8;
}

.col-est {
    flex: 1.2;
    text-align: right;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    margin: 15px 0;
    background-color: var(--color-dark);
    border-radius: 4px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

th {
    background-color: rgba(0, 181, 226, 0.1);
    color: var(--color-primary);
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Editable inputs in table */
td input {
    background: transparent;
    border: none;
    padding: 4px;
    width: 100%;
}

td input:focus {
    background: rgba(255, 255, 255, 0.1);
}

/* Dashboard */
.dashboard {
    display: flex;
    justify-content: space-between;
    background-color: var(--color-card);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 25px;
}

.dash-item {
    text-align: center;
    flex: 1;
}

.dash-item .label {
    color: var(--color-text-grey);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.dash-item .value {
    font-size: 1.5rem;
    font-weight: 700;
}

.dash-item .positive {
    color: var(--color-success);
}

.dash-item.final {
    border-left: 2px solid var(--color-primary);
    padding-left: 20px;
}

.dash-item .highlight {
    font-size: 2rem;
    color: var(--color-primary);
}

/* Actions */
.actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 50px;
}

.export-group {
    display: flex;
    gap: 10px;
}

/* Sidebar DB Panel */
#db-panel {
    margin-top: 15px;
}

.info-text {
    font-size: 0.8rem;
    color: var(--color-text-grey);
    margin-bottom: 10px;
    font-style: italic;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-dark);
}

::-webkit-scrollbar-thumb {
    background: #4a5a75;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
        overflow-y: auto;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: 400px;
    }

    .main-content {
        overflow-y: visible;
        padding: 15px;
    }

    .row,
    .calc-row,
    .dashboard {
        flex-direction: column;
        gap: 20px;
        align-items: stretch;
    }

    .col-est {
        text-align: left;
    }

    .dash-item.final {
        border-left: none;
        border-top: 2px solid var(--color-primary);
        padding-top: 20px;
        margin-top: 10px;
    }

    .actions {
        flex-direction: column-reverse;
        gap: 20px;
    }

    .export-group {
        flex-direction: column;
        width: 100%;
    }

    .sidebar-logo {
        max-width: 150px;
    }
}

/* Navigation Styles */
.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--color-text-grey);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: 0.2s;
    font-weight: 600;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--color-white);
}

.nav-link.active {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.nav-link i {
    font-size: 1.1rem;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Full Page Table */
.full-height-table {
    min-height: 400px;
}

/* Adjust table inputs for full page */
#database-page table input,
#database-page table select {
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

#database-page table input:focus {
    background: rgba(0, 0, 0, 0.4);
    border-color: var(--color-primary);
}

/* Logo Styles */
.sidebar-logo {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 10px auto;
    padding: 10px;
}