:root {
    --background-color: #fdf6e3; /* Light Cream */
    --sidebar-bg: #c0392b; /* Pomegranate Red */
    --widget-bg: #ffffff;
    --primary-color: #f1c40f; /* Sunflower Yellow */
    --secondary-color: #d35400; /* Pumpkin Orange */
    --text-color: #333333;
    --text-color-light: #f9fafb;
    --border-color: #e5e7eb;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    background-image: url('data:image/svg+xml;utf8,<svg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path d="M12.5 0v12.5h-12.5v12.5h12.5v12.5h-12.5v12.5h12.5v12.5h-12.5v12.5h12.5v12.5h-12.5v12.5h12.5v12.5h12.5v-12.5h12.5v12.5h12.5v-12.5h12.5v12.5h12.5v-12.5h12.5v12.5h12.5v-12.5h12.5v-12.5h-12.5v-12.5h12.5v-12.5h-12.5v-12.5h12.5v-12.5h-12.5v-12.5h12.5v-12.5h-12.5v-12.5h-12.5v12.5h-12.5v-12.5h-12.5v12.5h-12.5v-12.5h-12.5zm12.5 12.5h12.5v12.5h-12.5v-12.5zm12.5 12.5h12.5v12.5h-12.5v-12.5zm12.5 12.5h12.5v12.5h-12.5v-12.5zm12.5 12.5h12.5v12.5h-12.5v-12.5z" fill="%23d35400" fill-opacity="0.05"/></svg>');
}

.container {
    display: flex;
}

.sidebar {
    width: 240px;
    background-color: var(--sidebar-bg);
    color: var(--text-color-light);
    min-height: 100vh;
    border-right: 3px solid var(--primary-color);
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    padding: 2rem;
    text-align: center;
    color: var(--primary-color);
    letter-spacing: 1px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

nav li a {
    display: block;
    padding: 1rem 2rem;
    text-decoration: none;
    color: var(--text-color-light);
    transition: background-color 0.2s;
}

nav li.active a, nav li a:hover {
    background-color: #a52a2a; /* Brown Red */
    border-left: 3px solid var(--primary-color);
    padding-left: calc(2rem - 3px);
}

.main-content {
    flex-grow: 1;
    padding: 2rem;
}

.page-content {
    display: none;
}

.page-content.active {
    display: block;
}

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

header h1 {
    font-size: 2rem;
    font-weight: 600;
    margin: 0;
    color: #a52a2a;
}

.settings-bar {
    display: flex;
    gap: 1.5rem;
}

.setting {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.setting label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
}

.setting select {
    font-family: inherit;
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--widget-bg);
}

.widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.widget {
    background-color: var(--widget-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    border: 1px solid var(--border-color);
}

.full-width-widget {
    grid-column: 1 / -1;
}

.widget h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: #c0392b;
}

.price-widget .price {
    font-size: 3.5rem;
    font-weight: 700;
    color: #1f2937;
}

.price-widget .prediction {
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.prediction-reason {
    font-size: 0.875rem;
    color: #6b7280;
    text-align: center;
    margin-top: 0.5rem;
}

.last-updated {
    font-size: 0.8rem;
    color: #9ca3af;
    text-align: center;
    margin-top: 1rem;
}

.prediction.buy {
    background-color: #dcfce7; /* Light Green */
    color: #166534; /* Dark Green */
}

.prediction.hold {
    background-color: #fef9c3; /* Light Yellow */
    color: #854d0e; /* Dark Yellow */
}

.prediction.sell {
    background-color: #fee2e2; /* Light Red */
    color: #991b1b; /* Dark Red */
}

.chart-container {
    height: 250px;
}

.chart .line {
    fill: none;
    stroke: var(--secondary-color);
    stroke-width: 2.5;
    stroke-linejoin: round;
    stroke-linecap: round;
}

/* Gold Brokers Widget */
.gold-brokers-widget .broker {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

.gold-brokers-widget .broker:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.gold-brokers-widget h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.gold-brokers-widget p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.trade-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.trade-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.trade-btn.buy {
    background-color: #22c55e; /* Green */
}

.trade-btn.sell {
    background-color: #ef4444; /* Red */
}

.trade-btn:hover {
    opacity: 0.9;
}

/* News Widget */
.news-feed {
    max-height: 300px;
    overflow-y: auto;
}

.news-item {
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.news-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.news-item a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
}

.news-item a:hover {
    color: var(--secondary-color);
}

.news-item p {
    font-size: 0.8rem;
    color: #6b7280;
    margin: 0.25rem 0 0 0;
}

/* Portfolio & Trade & Analyser & Feedback Forms */
.holding-form, .trade-form, .analyser-form, #feedback-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.holding-form input, .trade-form input, .analyser-form input, #feedback-form input, #feedback-form textarea {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
}

#feedback-form textarea {
    min-height: 120px;
    resize: vertical;
}

.holding-form button, .trade-form button, .analyser-form button, #feedback-form button {
    padding: 0.75rem;
    border: none;
    border-radius: 6px;
    background-color: var(--secondary-color);
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.holding-form button:hover, .trade-form button:hover, .analyser-form button:hover, #feedback-form button:hover {
    background-color: #a52a2a;
}

#portfolio-summary p {
    font-size: 1.1rem;
    margin: 0.5rem 0;
}

#holdings-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 2rem;
}

#holdings-table th, #holdings-table td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

#holdings-table th {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sell-holding-btn {
    padding: 0.25rem 0.75rem;
    border: 1px solid #ef4444; /* Red */
    color: #ef4444;
    background-color: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.sell-holding-btn:hover {
    background-color: #fee2e2; /* Light Red */
}

#trade-confirmation, #feedback-status {
    margin-top: 1rem;
    font-weight: 600;
}

/* Feedback Form Rating */
.rating-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.stars {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
}

.stars input[type="radio"] {
    display: none;
}

.stars label {
    font-size: 2rem;
    color: #ccc;
    cursor: pointer;
    transition: color 0.2s;
}

.stars input[type="radio"]:checked ~ label,
.stars label:hover,
.stars label:hover ~ label {
    color: var(--primary-color);
}

/* Analyser Page */
.analysis-results {
    margin-top: 2rem;
}

.scenario {
    background-color: var(--widget-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.scenario h3 {
    margin-top: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.scenario p {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.scenario .rationale {
    font-size: 0.9rem;
    color: #6b7280;
    margin-top: 1rem;
}

.best-case h3 {
    color: #166534; /* Dark Green */
}

.worst-case h3 {
    color: #991b1b; /* Dark Red */
}

/* Alerts Page */
.alert-form {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.alert-form input {
    flex-grow: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
}

.alert-form button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    background-color: var(--secondary-color);
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.alert-form button:hover {
    background-color: #a52a2a;
}

.alert-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.alert-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.alert-list li:last-child {
    border-bottom: none;
}

.alert-list .delete-alert {
    padding: 0.25rem 0.75rem;
    border: 1px solid #ef4444; /* Red */
    color: #ef4444;
    background-color: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.alert-list .delete-alert:hover {
    background-color: #fee2e2; /* Light Red */
}