/*
    A professional and appealing stylesheet for the Global Exchange web application.
    This style guide uses a clean, modern aesthetic with a dark color scheme.
*/

/* --- Global Styles --- */
:root {
    --primary-color: #007bff; /* A vibrant blue for buttons and accents */
    --primary-hover-color: #0056b3; /* Darker blue for hover state */
    --background-color: #f4f7f6; /* A light grey for the overall page background */
    --card-background-color: #ffffff; /* White for content cards */
    --text-color: #333333; /* Dark grey for general text */
    --heading-color: #1a1a1a; /* Very dark grey for headings */
    --border-color: #e0e0e0; /* Light grey for borders */
    --flash-success: #28a745; /* Green for success messages */
    --flash-error: #dc3545; /* Red for error messages */
    --flash-info: #17a2b8; /* Blue for info messages */
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    box-sizing: border-box;
}

/* --- Header & Footer --- */
header {
    background-color: var(--card-background-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header .logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

footer {
    padding: 1rem 2rem;
    background-color: var(--card-background-color);
    color: #6c757d;
    text-align: center;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

/* --- Main Layout --- */
.container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.dashboard-container {
    display: flex;
    width: 100%;
    max-width: 1200px;
    margin: 2rem auto;
    background-color: var(--background-color);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    /* Added to prevent the sidebar from stretching */
    align-items: flex-start;
}

.sidebar {
    width: 250px;
    background-color: var(--card-background-color);
    padding: 2rem;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--heading-color);
}

.sidebar a {
    text-decoration: none;
    color: var(--text-color);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    transition: background-color 0.2s, color 0.2s;
    font-weight: 500;
}

.sidebar a:hover, .sidebar a.active {
    background-color: var(--primary-color);
    color: #ffffff;
}

.main-content {
    flex-grow: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* --- Cards --- */
.dashboard-card {
    background-color: var(--card-background-color);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.dashboard-card h2 {
    margin-top: 0;
    font-size: 1.5rem;
    color: var(--heading-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

/* --- Info Blocks --- */
.info-block {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.info-block p {
    margin: 0;
    color: var(--text-color);
    font-weight: 500;
}

/* --- Forms & Inputs --- */
.auth-card {
    background-color: var(--card-background-color);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    /* UPDATED: Center text within the auth card */
    text-align: center;
}

.auth-card h1 {
    margin-top: 0;
    color: var(--heading-color);
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    /* NEW: Align items to center */
    align-items: center;
}

/* UPDATED INPUT STYLES TO CENTER THEM */
input[type="text"], input[type="password"], input[type="number"] {
    /* Changed to max-width to allow for smaller containers */
    max-width: 300px;
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-color);
    transition: border-color 0.2s;
    /* NEW: Auto margins to center the block element */
    margin: 0 auto;
}

input[type="text"]:focus, input[type="password"]:focus, input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-section {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    /* UPDATED: Center text within the form section */
    text-align: center;
}

.form-section h3 {
    margin-top: 0;
    color: var(--heading-color);
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

/* CORRECTED CSS FOR BANKING DASHBOARD FORMS */
.form-section form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.link-container {
    margin-top: 1.5rem;
}

.link-container a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
    transition: color 0.3s;
}

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

/* --- Activity List --- */
.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

.activity-list .transaction-amount.deposit,
.activity-list .transaction-amount.transfer-in {
    color: var(--flash-success);
    font-weight: 600;
}

.activity-list .transaction-amount.withdrawal,
.activity-list .transaction-amount.transfer-out {
    color: var(--flash-error);
    font-weight: 600;
}

/* --- Tables --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

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

.data-table th {
    background-color: var(--background-color);
    font-weight: 600;
    color: var(--heading-color);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* UPDATED CSS FOR STOCK MARKET DASHBOARD FORMS */
.data-table td form {
    display: flex;
    align-items: center;
    gap: 8px;
    /* NEW: Align buttons to the right side of the table cell */
    justify-content: flex-end;
}


/* --- Utility Classes --- */
.button-primary, .button-secondary, .button-danger {
    background-color: var(--primary-color);
    color: #ffffff;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.3s, transform 0.1s;
    text-decoration: none;
    /* NEW: Display block to allow margins to work, overriding inline-block */
    display: block;
    text-align: center;
    /* NEW: Auto margins and max-width to center the buttons on auth page */
    max-width: 300px;
    margin: 0 auto;
}

/* UPDATED: Override for buttons in the data table to remove the auto margins and max-width */
.data-table .button-primary,
.data-table .button-secondary,
.data-table .button-danger {
    margin: 0;
    max-width: none;
}

.button-primary:hover {
    background-color: var(--primary-hover-color);
}

.button-primary:active, .button-secondary:active, .button-danger:active {
    transform: translateY(1px);
}

.button-secondary {
    background-color: #6c757d;
}

.button-secondary:hover {
    background-color: #5a6268;
}

.button-danger {
    background-color: var(--flash-error); /* Red color for danger actions */
}

.button-danger:hover {
    background-color: #c82333; /* Darker red on hover */
}

.flash-message {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
}

.flash-message.success {
    background-color: #d4edda;
    color: var(--flash-success);
    border: 1px solid #c3e6cb;
}

.flash-message.error {
    background-color: #f8d7da;
    color: var(--flash-error);
    border: 1px solid #f5c6cb;
}

.flash-message.info {
    background-color: #d1ecf1;
    color: var(--flash-info);
    border: 1px solid #bee5eb;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
        margin: 1rem;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}
