/* portfolioManager.css */

/* Color palette and sizing variables for the redesigned UI */
:root {
    --sidebar-bg: #2E3A46;
    --sidebar-hover: #3C4F65;
    --primary-color: #1ABC9C;
    --danger-color: #E74C3C;
    --bg-color: #F5F7FA;
    --card-bg: #FFFFFF;
    --text-color: #333333;
    --secondary-text: #6F7D8A;
    --border-radius: 8px;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg-color);
    color: var(--text-color);
    font-family: "Segoe UI", Tahoma, sans-serif;
    line-height: 1.5;
}

/* Layout structure */
.layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar navigation */
.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    color: #ecf0f1;
    display: flex;
    flex-direction: column;
    padding: 20px 15px;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
}

.sidebar-logo h2 {
    margin: 0;
    font-size: 20px;
    color: #ecf0f1;
}

/* Logo inside sidebar */
.sidebar-logo .logo {
    display: block;
    width: 48px;
    height: 48px;
    margin: 0 auto 10px auto;
}

/* Description text in sidebar */
.sidebar-desc {
    color: #bdc3c7;
    font-size: 12px;
    line-height: 1.4;
    margin: 10px 0 20px 0;
}

.sidebar-footer {
    margin-top: auto;
    font-size: 12px;
    line-height: 1.4;
    color: #95a5a6;
}

.sidebar-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.sidebar-footer a:hover {
    text-decoration: underline;
}

.pm-nav-button {
    display: block;
    width: 100%;
    background: none;
    border: none;
    padding: 12px 10px;
    margin: 2px 0;
    text-align: left;
    color: #ecf0f1;
    font-size: 16px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.2s, border-left-color 0.2s;
}

.pm-nav-button:hover {
    background: var(--sidebar-hover);
}

.pm-nav-button.active {
    background: var(--sidebar-hover);
    border-left-color: var(--primary-color);
    color: #ffffff;
}

/* Overview button styling and separation */
.overview-container {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #3C4F65; /* subtle divider above overview */
}

.pm-overview-btn {
    /* Override general button styles: transparent background with outline */
    background: transparent !important;
    color: var(--primary-color) !important;
    border-left: 3px solid transparent;
    border: 1px solid var(--primary-color);
    text-align: center;
    margin-top: 5px;
    transition: background 0.2s, color 0.2s;
}

.pm-overview-btn:hover {
    background: var(--primary-color) !important;
    color: #ffffff !important;
}

/* Active state for overview button: match sidebar hover style but keep primary accent */
.pm-overview-btn.active {
    background: var(--sidebar-hover) !important;
    color: #ffffff !important;
    /* Override entire left border to ensure color shows despite earlier border-left rule */
    border-left: 3px solid var(--primary-color) !important;
    border: 1px solid var(--primary-color) !important;
}

/* Ensure overview button active state takes precedence over nav default active styling */
.pm-nav-button.pm-overview-btn.active {
    background: var(--sidebar-hover) !important;
    color: #ffffff !important;
    border-left: 3px solid var(--primary-color) !important;
    border: 1px solid var(--primary-color) !important;
}

/* Main content area */
.content-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.main-header h1 {
    margin: 0;
    font-size: 28px;
    color: var(--text-color);
}

.description {
    color: var(--secondary-text);
    max-width: 800px;
    margin: 5px 0 30px 0;
}

/* General section styling */
.pm-section {
    margin-bottom: 40px;
}

/* Show section titles normally. Previously we hid all h2 inside sections, but
   now we rely on the .section-header structure to present the title and description. */

/* Section header styling */
.section-header {
    margin-bottom: 20px;
}
.section-title {
    font-size: 24px;
    margin: 0;
    color: var(--text-color);
    display: block;
}
.section-desc {
    margin: 5px 0 20px 0;
    color: var(--secondary-text);
    font-size: 14px;
    max-width: 800px;
}

/* Align logo next to the title in the sidebar */
.logo-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.logo-title .logo {
    /* Increase logo size by ~25% for stronger presence */
    width: 45px;
    height: 45px;
    margin: 0;
}
.logo-title h2 {
    font-size: 18px;
    margin: 0;
    color: #ecf0f1;
}

/* Card element */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.card h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text-color);
    font-size: 18px;
}

.card h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--text-color);
    font-size: 16px;
}

/* Forms */
.pm-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pm-form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pm-form-group label {
    font-weight: 600;
    color: var(--text-color);
}

.pm-form-group input,
.pm-form-group select,
.pm-form-group textarea {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    color: var(--text-color);
    background: #fff;
}

.pm-form-group textarea {
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 10px;
}

button {
    cursor: pointer;
    border: none;
    border-radius: 4px;
    padding: 8px 14px;
    font-size: 14px;
}

button[type="submit"],
button:not(.pm-cancel-btn) {
    background: var(--primary-color);
    color: #fff;
}

.pm-cancel-btn {
    background: var(--danger-color);
    color: #fff;
}

button:hover {
    opacity: 0.92;
}

/* Table styling */
.table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 260px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.table-wrapper.small {
    max-height: 200px;
}

.pm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.pm-table thead {
    background: #ecf0f1;
}

.pm-table th,
.pm-table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
    text-align: left;
}

.pm-table tr:nth-child(even) {
    background: #f9f9f9;
}

.pm-table button {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    margin-right: 4px;
    cursor: pointer;
}

.pm-table button:hover {
    opacity: 0.92;
}

/* Layout helpers */
.two-columns {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.column {
    flex: 1;
    min-width: 280px;
}

.details-layout {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.chart-wrapper {
    flex: 1;
    min-width: 280px;
}

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

.pm-details-table th {
    background: #ecf0f1;
    color: var(--text-color);
    font-weight: bold;
}

.pm-details-table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.pm-details-chart {
    width: 100%;
    height: 260px;
}

/* Valuation specific */
.valuation-select {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.valuation-select button {
    background: var(--primary-color);
    color: #fff;
    padding: 6px 12px;
    font-size: 14px;
}

.valuation-select button:hover {
    opacity: 0.92;
}

.portfolio-total {
    margin: 10px 0;
    font-weight: 600;
    font-size: 16px;
    color: var(--text-color);
}

/* Hide elements by default; JS will toggle .hidden */
.hidden {
    display: none;
}

/* VDC base fields hidden until selected by JS */
.vdc-base-fields {
    display: none;
}

.vdc-base-1 {
    margin-top: 15px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        width: 180px;
    }
    .pm-nav-button {
        font-size: 14px;
        padding: 10px 8px;
    }
}
