/* Base Styles */
:root {
    --icm-dark: #131722;
    --icm-light: #ffffff;
    --icm-gray: #f0f2f5; /* Slightly softer gray */
    --text-dark: #2e384d;
    --text-light: #b2b5be;
    --border-color: #e0e3eb;
    --primary-green: #4CAF50;
    --primary-green-dark: #3e8e41;
    --rating-star-color: #f39c12;
    --footer-bg: #000000; /* Darker footer */
    --footer-text: #cccccc;
    --footer-heading: #e0e0e0;
    --footer-border: #444;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Modern font stack */
    background: var(--icm-gray);
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* Header (now just a top bar) */
.header {
    /* Removed content, so removing padding as well */
    display: none; /* Hide the empty nav element */
}

/* Moved Site Title and Tagline Section */
.site-tagline {
    max-width: 800px;
    margin: 30px auto 20px auto; /* Add margin above and below */
    padding: 0 15px;
    text-align: center;
}

.site-tagline h1 {
    color: var(--text-dark);
    margin: 0 0 5px 0; /* Adjusted margin */
    font-size: 2rem; /* Slightly smaller */
    font-weight: 700;
}

.site-tagline p {
    color: #555; /* Slightly darker text */
    margin: 0;
    font-size: 0.9rem; /* Slightly smaller */
}

/* Intro Text Section - Adjusted for new position */
.intro-text {
    max-width: 800px;
    margin: 20px auto; /* Adjusted top margin */
    padding: 0 15px;
    text-align: center;
    color: var(--text-dark);
    font-size: 1.1rem; /* Increased text size */
    line-height: 1.7;
}

/* Main Container */
.brokers-container {
    padding: 20px 15px; /* Add padding around the cards container */
    max-width: 1000px;
    margin: 20px auto;
}

/* Broker Cards */
.broker-card {
    border: 1px solid var(--border-color);
    border-radius: 10px; /* Slightly more rounded */
    padding: 25px;
    margin-bottom: 25px; /* Only bottom margin needed */
    background: var(--icm-light);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06); /* Subtle shadow */
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    overflow: hidden; /* Ensure content stays within rounded corners */
    display: flex; /* Use flexbox on the card */
    flex-direction: column; /* Stack contents vertically */
}

.broker-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

/* Container for details and media */
.broker-top-content {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    justify-content: space-between; /* Pushes details left, media right */
    width: 100%; /* Ensure it takes full width of card */
    margin-bottom: 20px; /* Space before separator */
}

.broker-details {
    flex-basis: 65%; /* Allocate 65% width to details */
    min-width: 250px; /* Minimum width to prevent squishing */
}

.broker-media {
    flex-basis: 30%; /* Allocate 30% width to media */
    display: flex;
    flex-direction: column; /* Stack logo and rating vertically */
    align-items: flex-start; /* Align logo and rating to the left */
    justify-content: flex-start; /* Align logo and rating to the top */
    min-width: 120px; /* Minimum width for the media block */
    margin-top: -15px; /* Move logos and ratings up slightly */
}

.broker-header {
    align-items: flex-start; /* Align header contents to the left */
    margin-bottom: 10px; /* Space between logo and rating */
    width: 100%; /* Ensure header takes full width of media container */
}

.broker-header a {
    display: block; /* Make the link block-level to wrap the image */
    line-height: 0; /* Remove extra space below image */
}

.broker-logo {
    width: 250px; /* Default size */
    max-height: 120px; /* Default size */
    height: auto;
    display: block;
    object-fit: contain;
    /* Align to the left */
    margin: 5px 0 0 0; /* Add 5px top margin, 0 left/right margin */
}

/* Class for larger logos */
.broker-logo-large {
    width: 300px; /* Make it bigger */
    max-height: 150px; /* Make it bigger */
    /* Align to the left */
    margin: 5px 0 0 0; /* Add 5px top margin, 0 left/right margin */
}

.rating {
    color: var(--rating-star-color);
    font-size: 1rem;
    margin-top: 5px; /* Optional: space above rating */
    margin-left: auto; /* Push the rating to the right */
}
.rating .fas.fa-star { /* Ensure only solid stars get the weight */
    font-weight: 900;
}
.rating .far.fa-star {
    font-weight: 400;
}

.broker-separator {
    border-bottom: 1px solid var(--border-color);
    margin: 0 0 20px 0; /* Adjusted margin */
    height: 0;
    width: 100%; /* Ensure separator is full width */
}

.broker-details ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.broker-details li {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    font-size: 0.95rem;
    color: #333;
}

.broker-details li i {
    margin-right: 10px;
    color: var(--primary-green);
    width: 20px;
    text-align: center;
}

/* Specific styling for regulation info */
.regulation-info {
    align-items: flex-start !important;
    font-size: 0.85rem; /* Make the main regulation text slightly smaller */
}

.regulation-info > i {
    margin-top: 3px;
}

.regulation-badge {
    display: inline-flex;
    align-items: center;
    background: var(--icm-gray);
    padding: 2px 6px; /* Smaller padding */
    border-radius: 4px;
    margin-right: 6px;
    margin-bottom: 6px;
    font-size: 0.75rem; /* Make badge text smaller */
    border: 1px solid var(--border-color);
    color: #555;
    line-height: 1.3;
    white-space: nowrap;
}

.regulation-badge i.flag {
    font-size: 1.1em; /* Adjusted flag size slightly */
    margin-right: 5px;
    color: inherit;
    width: auto;
    text-align: left;
}

/* Green Visit Site Button */
.visit-btn {
    display: block;
    width: 100%;
    padding: 12px 15px;
    background: var(--primary-green);
    color: white;
    text-align: center; /* Keep text centered */
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    margin: 0 auto 5px auto; /* Centered horizontally, add space below */
}

.visit-btn:hover {
    background: var(--primary-green-dark);
    transform: translateY(-2px);
}

.risk-note {
    font-size: 0.7rem; /* Using rem for better accessibility, equivalent to 12px */
    color: #999;
    text-align: center; /* Ensure text is centered */
    margin: 5px auto 0 auto; /* Centered horizontally, add space above */
}

/* Footer */
.footer {
    background: #000000;
    color: #444444;
    padding: 15px 0 10px;
    margin-top: 30px; /* Add space above footer */
    font-size: 12px;
    line-height: 1.5;
}

.footer-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer h3 {
    color: #333333;
    font-size: 14px;
    border-bottom: 1px solid #333;
    padding-bottom: 6px;
    margin-top: 12px;
    margin-bottom: 10px;
    font-weight: 600;
}

.footer p {
    color: #444444;
    margin-bottom: 10px;
}

.footer-section {
    margin-bottom: 20px;
}

/* Adjusted Risk Warning colors */
.footer-section.risk-warning h3 {
    color: #333333; /* Match other headings */
    border-bottom-color: #333; /* Match other borders */
}

.footer-section.risk-warning p {
    color: #444444; /* Match other text */
    margin-bottom: 15px;
    font-size: 11px;
    line-height: 1.6;
}

.copyright {
    font-size: 11px;
    color: #666666;
    margin-top: 15px;
    text-align: center;
    border-top: 1px solid #333;
    padding-top: 10px;
}

/* Chart styling removed */
.chart-container {
    display: none;
}

/* Responsive Adjustments - This section makes the page mobile compatible */
@media (max-width: 768px) {
    .header {
        padding: 15px 20px; /* Adjusted padding for smaller screens */
    }

    /* Adjusted Site Title and Tagline Section */
    .site-tagline {
        margin: 20px auto; /* Adjusted margin */
    }
    .site-tagline h1 {
        font-size: 1.8rem; /* Adjusted size */
    }
    .site-tagline p {
        font-size: 0.9rem; /* Adjusted size */
    }

    .intro-text {
        margin: 15px auto; /* Adjusted top margin */
        font-size: 1rem; /* Increased text size for smaller screens */
    }
    /* Stack details and media vertically on smaller screens */
    .broker-top-content {
        flex-direction: column;
    }

    .broker-details {
        flex-basis: 100%; /* Details take full width */
        margin-right: 0; /* Remove right margin */
        margin-bottom: 20px; /* Add space below details */
    }

    .broker-media {
        flex-basis: 100%; /* Media takes full width */
        flex-direction: column; /* Ensure media contents are still column */
        align-items: center; /* Center contents horizontally */
        justify-content: flex-start;
        margin-top: 0; /* Remove negative margin on mobile if stacking */
    }

    .broker-header {
        align-items: center; /* Center header contents */
        margin-bottom: 10px; /* Space between logo and rating */
        width: 100%; /* Ensure header takes full width of media container */
    }

    .broker-logo {
        width: 250px; /* Increased default size on mobile */
        max-height: 120px; /* Increased max height */
        height: auto; /* Keep auto height */
        display: block; /* Ensure block display */
        object-fit: contain; /* Keep object fit */
        /* Center horizontally */
        margin: 5px auto 10px auto;
    }

    /* Larger logo size on mobile (adjust as needed) */
    .broker-logo-large {
        width: 300px; /* Increased larger size on mobile */
        max-height: 150px; /* Increased max height */
        height: auto; /* Keep auto height */
        object-fit: contain; /* Keep object fit */
         /* Center horizontally */
        margin: 5px auto 10px auto;
    }

    .rating {
         /* Push rating to the right */
        margin-left: auto;
        align-self: flex-end; /* Explicitly align rating to the right within the centered media block */
    }

    .broker-details li {
        font-size: 0.9rem;
    }

    /* Further reduce font size for regulation info on smaller screens */
    .regulation-info {
        font-size: 0.85rem;
    }
    .regulation-badge {
        font-size: 0.75rem;
        padding: 2px 6px;
    }

    .visit-btn {
        font-size: 0.95rem;
        padding: 10px 12px;
         /* Centered horizontally, add space below */
        margin: 0 auto 5px auto;
    }
    .risk-note {
        /* Centered horizontally, add space above */
        margin: 5px auto 0 auto;
    }
    .footer h3 {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .broker-card {
        padding: 20px;
    }

    .header {
        padding: 10px 15px; /* Further adjusted padding for smaller screens */
    }

    /* Adjusted Site Title and Tagline Section */
    .site-tagline {
        margin: 15px auto 10px auto; /* Adjusted margin */
    }
    .site-tagline h1 {
        font-size: 1.4rem; /* Adjusted size */
    }
    .site-tagline p {
        font-size: 0.8rem; /* Adjusted size */
    }

    .intro-text {
        margin: 10px auto; /* Adjusted top margin */
        font-size: 0.9rem; /* Make it a bit smaller */
    }

    /* Adjust logo sizes slightly smaller for very small screens */
    .broker-logo {
        width: 220px;
        max-height: 110px;
        /* Center horizontally */
        margin: 5px auto 10px auto;
    }
    .broker-logo-large {
        width: 270px;
        max-height: 135px;
        /* Center horizontally */
        margin: 5px auto 10px auto;
    }

    .rating {
         /* Push rating to the right */
        margin-left: auto;
        align-self: flex-end; /* Explicitly align rating to the right within the centered media block */
    }

    .broker-details li {
        font-size: 0.9rem;
    }

    /* Regulation info remains the same size from 768px breakpoint down */

    .visit-btn {
        font-size: 0.95rem;
        padding: 10px 12px;
         /* Centered horizontally, add space below */
        margin: 0 auto 5px auto;
    }
     .risk-note {
        /* Centered horizontally, add space above */
        margin: 5px auto 0 auto;
    }
    .footer {
        font-size: 0.75rem;
    }
    .header h1 {
        font-size: 1.4rem; /* Adjusted size */
    }
    .header p {
        font-size: 0.8rem; /* Adjusted size */
    }
}