/* Espring Investment Dashboard V2 Styles */
.eimp-dashboard-wrapper {
    display: flex;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background-color: #f0f2f5;
    gap: 20px;
    padding: 20px;
    max-width: 1400px;
    margin: auto;
}

/* Sidebar */
.eimp-sidebar {
    flex: 0 0 280px;
    background-color: #2c3e50;
    color: #ecf0f1;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}
.eimp-user-profile { text-align: center; }
.eimp-user-profile img { border-radius: 50%; margin-bottom: 10px; }
.eimp-user-name { margin: 10px 0 5px 0; color: #ffffff; }
.eimp-user-total { font-size: 0.9em; color: #bdc3c7; margin-top: 0; }

.eimp-sidebar-nav { margin-top: 20px; }
.eimp-sidebar-nav h4 { color: #ffffff; border-bottom: 1px solid #34495e; padding-bottom: 10px; }
.eimp-sidebar-nav ul { list-style: none; padding: 0; margin: 0; }
.eimp-sidebar-nav ul li a {
    color: #ecf0f1;
    text-decoration: none;
    display: block;
    padding: 10px 5px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}
.eimp-sidebar-nav ul li a:hover { background-color: #34495e; }
.eimp-sidebar-bottom { margin-top: auto; text-align: center; }
.eimp-sidebar-bottom a { color: #bdc3c7; text-decoration: none; font-size: 0.9em; }

/* Main Content */
.eimp-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.eimp-row {
    display: flex;
    gap: 20px;
    width: 100%;
}
.eimp-panel, .eimp-kpi-box {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.eimp-panel h4, .eimp-kpi-box h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1em;
    color: #34495e;
}

/* KPI Boxes */
.eimp-kpi-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.eimp-kpi-box { text-align: center; }
.eimp-kpi-value {
    font-size: 2.5em;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}
.eimp-kpi-chart-container {
    height: 60px; /* Adjust as needed */
    position: relative;
    margin: 0 auto;
}
#eimpPieChart { max-height: 100%; }

/* Panels and Charts */
.eimp-panel-large { flex: 2; }
.eimp-panel-small { flex: 1; }
#eimpLineGraph { max-height: 300px; }

/* Project Pitch List */
.eimp-pitch-list { display: flex; flex-direction: column; gap: 15px; }
.eimp-pitch-item .eimp-pitch-title { display: flex; justify-content: space-between; margin-bottom: 5px; }
.eimp-pitch-item .eimp-pitch-title a { font-weight: bold; text-decoration: none; color: #2c3e50; }
.eimp-pitch-item .eimp-pitch-title span { font-size: 0.9em; color: #3498db; }
.eimp-progress-bar { background-color: #ecf0f1; border-radius: 10px; height: 8px; overflow: hidden; }
.eimp-progress-bar-inner { background-color: #3498db; height: 100%; border-radius: 10px; }

/* Activity & Payment Lists */
.eimp-activity-list, .eimp-payment-list { list-style: none; padding: 0; margin: 0; }
.eimp-activity-list li, .eimp-payment-list li {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f2f5;
    font-size: 0.95em;
}
.eimp-activity-list li:last-child, .eimp-payment-list li:last-child { border-bottom: none; }
.eimp-activity-date, .eimp-payment-date { color: #7f8c8d; font-size: 0.9em; }

/* Responsive adjustments for Dashboard */
@media (max-width: 1200px) {
    .eimp-dashboard-wrapper { flex-direction: column; }
    .eimp-row { flex-direction: column; }
    .eimp-kpi-row { grid-template-columns: 1fr; }
}

/*
=================================
SINGLE PROJECT & PLEDGE PAGE STYLES V6 (Definitive Layout)
=================================
*/

/* --- DESKTOP LAYOUT (using CSS Grid) --- */
.espring-project-wrapper {
    max-width: 1200px;
    margin: 40px auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Define the grid layout */
    display: grid;
    grid-template-columns: 2fr 1fr; /* 2/3 column and 1/3 column */
    /* This defines the exact layout you want for desktop */
    grid-template-areas:
        "title   title"        /* Title spans both columns at the top */
        "thumb   sidebar"      /* Image on left, sidebar on right, aligned */
        "content sidebar"      /* Content below image, sidebar continues */
        "coord   sidebar";      /* Coordinator below content, sidebar continues */
    gap: 30px;
    align-items: start; /* Aligns the top of grid items */
}

/* Assign each element to its named grid area */
.espring-project-wrapper .project-title { grid-area: title; }
.espring-project-wrapper .project-thumbnail { grid-area: thumb; }
.espring-project-wrapper .project-content { grid-area: content; }
.espring-project-wrapper .espring-project-sidebar { grid-area: sidebar; }
.espring-project-wrapper .project-coordinator { grid-area: coord; }


/* --- Child Element Styles (Mostly for looks) --- */
.espring-project-wrapper .project-thumbnail img { max-width: 100%; height: auto; border-radius: 8px; }
.espring-project-wrapper .project-title { font-size: 2.5em; margin-bottom: 0; line-height: 1.2; }
.espring-project-wrapper .project-content { line-height: 1.7; }
.espring-project-wrapper .espring-project-sidebar { position: sticky; top: 40px; height: fit-content; }
.espring-project-wrapper .sidebar-box { background: #f8f9fa; padding: 30px; border-radius: 8px; border: 1px solid #e9ecef; }
.espring-project-wrapper .amount-raised { font-size: 2em; font-weight: 700; margin: 0; }
.espring-project-wrapper .amount-raised .raised-text { font-size: 0.6em; font-weight: 400; color: #6c757d; }
.espring-project-wrapper .progress-info { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; font-size: 0.9em; color: #6c757d; margin: 10px 0; }
.espring-project-wrapper .progress-info .days-left { font-weight: bold; color: #e67e22; }
.espring-project-wrapper .progress-bar-container { background: #e9ecef; height: 10px; border-radius: 5px; position: relative; margin-bottom: 25px; }
.espring-project-wrapper .progress-bar { background: #28a745; height: 100%; border-radius: 5px; transition: width 0.5s ease-in-out; }
.espring-project-wrapper .progress-percentage { position: absolute; right: -22px; top: 50%; transform: translateY(-50%); font-size: 0.8em; font-weight: bold; color: #28a745; }
.espring-project-wrapper .pledge-button { display: block; width: 100%; box-sizing: border-box; padding: 15px; background: #ff8c00; color: #fff !important; text-align: center; font-weight: bold; font-size: 1.2em; border-radius: 5px; text-decoration: none; transition: background-color 0.2s; }
.espring-project-wrapper .pledge-button:hover { background: #e07b00; }
.espring-project-wrapper .pledgers-title { font-size: 1.1em; margin-top: 30px; border-top: 1px solid #e9ecef; padding-top: 20px; }
.espring-project-wrapper .pledgers-list { list-style: none; padding: 0; margin: 0; }
.espring-project-wrapper .pledgers-list li { display: flex; align-items: center; gap: 15px; margin-bottom: 15px; }
.espring-project-wrapper .pledgers-list img { border-radius: 50%; }

.project-coordinator { padding-top: 20px; margin-top: 20px; border-top: 1px solid #e9ecef; display: flex; align-items: center; gap: 15px; }
.project-coordinator img { border-radius: 50%; }
.coordinator-info { display: flex; flex-direction: column; }
.coordinator-name { font-weight: bold; text-decoration: none; color: #333; }
.coordinator-title { font-size: 0.9em; color: #6c757d; }


/* --- MOBILE LAYOUT (using Flexbox for exact ordering) --- */
@media (max-width: 800px) {
    /* Switch from Grid to Flexbox on mobile */
    .espring-project-wrapper {
        display: flex;
        flex-direction: column;
    }
    
    /* Assign the exact order you want for mobile screens */
    .espring-project-wrapper .project-title { order: 1; }
    .espring-project-wrapper .project-thumbnail { order: 2; }
    .espring-project-wrapper .project-coordinator { order: 3; }
    .espring-project-wrapper .espring-project-sidebar { order: 4; }
    .espring-project-wrapper .project-content { order: 5; }

    /* Un-stick the sidebar on mobile */
    .espring-project-wrapper .espring-project-sidebar {
        position: static;
    }
}

/* --- PLEDGE FORM PAGE STYLES --- */
.eimp-pledge-page-wrapper { display: flex; flex-wrap: wrap; gap: 30px; max-width: 1000px; margin: 40px auto; padding: 20px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.eimp-pledge-page-wrapper .eimp-pledge-form-container { flex: 1.5; min-width: 320px; }
.eimp-pledge-page-wrapper .eimp-pledge-sidebar { flex: 1; min-width: 300px; }
.eimp-pledge-page-wrapper .form-header { border-bottom: 1px solid #e9ecef; padding-bottom: 15px; margin-bottom: 25px; }
.eimp-pledge-page-wrapper .form-return-link a { text-decoration: none; color: #6c757d; }
.eimp-pledge-page-wrapper .form-title { margin-top: 10px; }
.eimp-pledge-page-wrapper .form-group { margin-bottom: 20px; }
.eimp-pledge-page-wrapper .form-group label { display: block; font-weight: 600; margin-bottom: 8px; }
.eimp-pledge-page-wrapper .form-group input[type="number"],
.eimp-pledge-page-wrapper .form-group input[type="text"] { width: 100%; padding: 12px; font-size: 1.1em; border: 1px solid #ced4da; border-radius: 4px; box-sizing: border-box; }
.eimp-pledge-page-wrapper .calculator-results { background: #f8f9fa; border: 1px solid #e9ecef; padding: 20px; border-radius: 5px; margin: 20px 0; }
.eimp-pledge-page-wrapper .calculator-results h3 { margin-top: 0; }
.eimp-pledge-page-wrapper .calculator-results table { width: 100%; border-collapse: collapse; }
.eimp-pledge-page-wrapper .calculator-results td { padding: 8px 0; border-bottom: 1px solid #e9ecef; }
.eimp-pledge-page-wrapper .calculator-results tr:last-child td { border-bottom: none; }
.eimp-pledge-page-wrapper .calculator-results .total-payout { font-weight: bold; }
.eimp-pledge-page-wrapper .payment-instructions { color: #6c757d; font-size: 0.9em; border-left: 3px solid #007bff; padding-left: 15px; margin-bottom: 20px; }
.eimp-pledge-page-wrapper .transaction-group { display: flex; align-items: flex-end; gap: 10px; }
.eimp-pledge-page-wrapper .transaction-group .form-group { flex: 1; margin-bottom: 0; }
.eimp-pledge-page-wrapper .submit-pledge-button { padding: 12px 20px; font-size: 1.1em; background: #007bff; color: #fff; border: none; border-radius: 4px; cursor: pointer; height: 48px; }
.eimp-pledge-page-wrapper .eimp-form-message { padding: 15px; border-radius: 4px; margin-top: 20px; }
.eimp-pledge-page-wrapper .eimp-form-message.success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.eimp-pledge-page-wrapper .eimp-form-message.error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.eimp-pledge-page-wrapper .disclaimer-box,
.eimp-pledge-page-wrapper .faq-box { background: #fff; padding: 20px; border-radius: 5px; border: 1px solid #e9ecef; margin-bottom: 20px; }
.eimp-pledge-page-wrapper .faq-box details { margin-bottom: 10px; }
.eimp-pledge-page-wrapper .faq-box summary { cursor: pointer; font-weight: bold; }

/*
=================================
PLEDGE FORM - PROGRESS BAR STYLES
=================================
*/
.pledge-form-progress {
    margin-bottom: 25px;
    font-size: 0.9em;
    color: #6c757d;
}

.pledge-form-progress .progress-bar-container {
    background: #e9ecef;
    height: 8px;
    border-radius: 4px;
    margin: 5px 0;
    width: calc(100% - 40px); /* Make room for percentage text */
    display: inline-block;
}

.pledge-form-progress .progress-bar {
    background: #28a745;
    height: 100%;
    border-radius: 4px;
}
.pledge-form-progress .progress-percentage {
    margin-left: 10px;
    font-weight: bold;
    color: #28a745;
}

/*
=================================
FUNDING DEADLINE STYLES
=================================
*/

.espring-project-wrapper .progress-info .days-left {
    font-weight: bold;
    color: #e67e22; /* A nice orange to stand out */
}

/*
=================================
PENDING PLEDGES LIST STYLES
=================================
*/
.pending-pledges-container {
    margin-top: 40px;
    border-top: 1px solid #e9ecef;
    padding-top: 20px;
}
.pending-pledges-container h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2em;
}
.pending-pledges-container .pending-pledge-items {
    list-style: none;
    padding: 0;
    margin: 0;
}
.pending-pledges-container .pending-pledge-items li {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-left: 4px solid #f39c12; /* Orange for pending */
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.95em;
}
.pending-pledges-container .status-pending {
    font-weight: bold;
    color: #f39c12;
}
/*
=================================
PROJECT STATUS RIBBON STYLES
=================================
*/
.sidebar-box {
    position: relative; /* Needed for the ribbon's positioning */
    overflow: hidden; /* Hides the parts of the ribbon that are outside the box */
}

.project-status-ribbon {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 150px;
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
    transform: rotate(45deg) translate(25%, -25%);
    transform-origin: center;
    color: #fff;
    font-weight: bold;
    font-size: 0.9em;
    text-transform: uppercase;
    box-shadow: 0 5px 10px rgba(0,0,0,0.1);
}

.project-status-ribbon.status-started {
    background-color: #2ecc71; /* Green for started */
}
.project-status-ribbon.status-completed {
    background-color: #3498db; /* Blue for completed */
}

/*
=================================
START PROJECT BUTTON STYLES
=================================
*/
.start-project-wrapper {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}
.start-project-button {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    background: #28a745; /* Green for a "go" action */
    color: #fff !important;
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
    border-radius: 5px;
    text-decoration: none;
    transition: background-color 0.2s;
}
.start-project-button:hover {
    background: #218838;
}
.start-project-message {
    font-size: 0.9em;
    margin-top: 10px;
    padding: 8px;
    border-radius: 3px;
    text-align: center;
}
.start-project-message.success { background-color: #d4edda; color: #155724; }
.start-project-message.error { background-color: #f8d7da; color: #721c24; }