/* ===================================================================
   Business Management System - Unified Stylesheet v2
   =================================================================== */

/* --- Main Wrappers --- */
.bms-payment-form-wrapper,
.bms-dashboard-wrapper,
.bms-data-tracker-wrapper {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    box-sizing: border-box;
}

/* --- General Form & Input Styles --- */
input[type="text"], input[type="number"], select {
    width: 100%;
    padding: 8px 12px;
    font-size: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    background-color: #fff;
    color: #333;
    height: 40px;
}

.bms-payment-form-wrapper .form-grid {
    display: grid;
    grid-template-columns: 1fr; /* Mobile first */
    gap: 15px;
    margin-bottom: 15px;
}

.bms-payment-form-wrapper button {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    background-color: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* --- Dashboard & Tracker Controls --- */
.bms-dashboard-wrapper .bms-controls,
.bms-data-tracker-wrapper .bms-tracker-controls {
    display: grid;
    grid-template-columns: 1fr; /* Mobile first */
    gap: 15px;
    margin-bottom: 25px;
    align-items: flex-end;
}

.bms-dashboard-wrapper .bms-control-group label,
.bms-data-tracker-wrapper .bms-tracker-controls label {
    font-weight: 600;
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    color: #444;
}

.bms-dashboard-wrapper .bms-controls select, 
.bms-dashboard-wrapper .bms-controls input,
.bms-data-tracker-wrapper .bms-tracker-controls input {
    display: block !important;
    width: 100% !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 8px 12px !important;
    font-size: 15px !important;
    line-height: 1.5 !important;
    color: #495057 !important;
    background-color: #fff !important;
    border: 1px solid #ced4da !important;
    border-radius: 4px !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
.bms-dashboard-wrapper .bms-controls select {
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E') !important;
    background-repeat: no-repeat !important;
    background-position: right .75rem center !important;
    background-size: 8px 10px !important;
}

/* --- Polished Financial Cards --- */
.bms-card-grid { display: grid; grid-template-columns: 1fr; gap: 20px; margin-top: 20px; }
.bms-card { background: #fff; padding: 20px; border: 1px solid #e9e9e9; border-radius: 6px; text-align: center; display: flex; flex-direction: column; }
.bms-card h3 { font-size: 14px; font-weight: 600; margin: 0 0 8px; color: #555; text-transform: uppercase; letter-spacing: 0.5px; }
.bms-card-title { cursor: pointer; }
.bms-card-title:after { content: ' ▼'; font-size: 11px; color: #aaa; }
.bms-card .amount { font-size: 28px; font-weight: 700; margin: 0 0 15px; color: #1d2327; line-height: 1.1; }
.bms-card .amount.profit { color: #008a20; }
.bms-card .amount.loss { color: #d63638; }
.bms-collapsible { display: none; margin-top: 15px; padding-top: 15px; border-top: 1px solid #eee; }
.bms-breakdown { text-align: left; list-style: none; padding: 0; margin: 0; font-size: 14px; }
.bms-breakdown li { display: grid; grid-template-columns: 1fr auto; gap: 15px; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.bms-breakdown li:last-child { border-bottom: none; }
.bms-breakdown .sub-breakdown { list-style: none; padding: 10px 10px 5px 15px; margin: 10px 0 0 0; border-top: 1px dotted #ccc; background-color: #fafafa; border-radius: 3px; }
.bms-breakdown .sub-breakdown li { padding: 4px 0; font-size: 13px; color: #555; border-bottom: none; }
.bms-breakdown .sub-breakdown strong { font-weight: 500; }

/* --- Data Tracker Specific Styles --- */
.bms-grand-total-summary {
    background: #fff; padding: 20px; border: 1px solid #e9e9e9; border-radius: 6px; text-align: center; margin-bottom: 20px;
}
.bms-grand-total-summary h2 {
    font-size: 18px; font-weight: 600; margin: 0; color: #555;
}
.bms-grand-total-summary h2 span {
    font-size: 28px; font-weight: 700; color: #d63638; display: block; margin-top: 8px;
}
.bms-tabs { border-bottom: 1px solid #ccc; margin-bottom: 20px; display: flex; }
.bms-tab-link {
    background-color: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 10px 15px;
    transition: 0.3s;
    font-size: 16px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px; /* Overlap the main border */
    color: #555;
}
.bms-tab-link:hover { color: #000; }
.bms-tab-link.active {
    border-bottom-color: #d63638; /* Match pink theme */
    font-weight: 600;
    color: #000;
}
.bms-tab-content { display: none; }
.bms-tab-content.active { display: block; }
.bms-tracker-summary { padding: 15px; background-color: #eef4f8; border: 1px solid #d0dce4; border-radius: 4px; margin: -10px 0 20px 0; text-align: right; }
.bms-tracker-summary h3 { margin: 0; font-size: 16px; font-weight: 600; color: #333; }
.bms-tracker-summary h3 span { color: #0073aa; font-weight: 700; }

/* Unified Table Styles */
.bms-tracker-table-wrapper, 
.bms-scroll-table-wrapper { overflow-x: auto; }
.bms-data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.bms-data-table th, .bms-data-table td { border: 1px solid #ddd; padding: 12px; text-align: left; vertical-align: middle; white-space: nowrap; }
.bms-data-table th { background-color: #f2f2f2; font-weight: 600; }
.bms-data-table .action-buttons { display: flex; flex-wrap: nowrap; gap: 5px; }

/* Unified Button Styles */
.bms-data-table .button, .bms-dashboard-wrapper .button {
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid #d63638;
    background: #fff;
    color: #d63638;
    transition: all 0.2s ease-in-out;
    flex-shrink: 0;
}
.bms-data-table .button:hover, .bms-dashboard-wrapper .button:hover {
    background: #d63638;
    color: #fff;
}

.bms-data-table .bms-action-link {
    color: #0073aa;
    cursor: pointer;
    text-decoration: underline;
    margin-right: 10px;
}
.bms-data-table .bms-action-link.delete { color: #a00; }

/* --- Modal & Other Styles --- */
.bms-modal { display: none; position: fixed; z-index: 9999; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.6); }
.bms-modal-content { 
    background-color: #fefefe; 
    margin: 15% auto; 
    padding: 25px; 
    border-radius: 6px; 
    width: 90%; 
    max-width: 500px; 
    position: relative; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); 
}
#bms-payout-log-modal .bms-modal-content { max-width: 800px; }
.bms-modal-close { color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; line-height: 1; position: absolute; top: 10px; right: 15px; }
.bms-modal h3, .bms-modal h4 { margin: 0 0 20px; font-size: 20px; color: #333; }
.bms-modal label { display: block; margin: 15px 0 5px; font-weight: 600; }
.bms-modal .button-primary,
#bms-payout-form button {
    width: 100%; margin-top: 20px; background-color: #d63638; border-color: #d63638; color: #fff; padding: 10px; font-size: 16px;
}
#bms-payout-form button:hover { background-color: #c02f2f; }
.bms-response { margin-top: 15px; padding: 10px; border-radius: 4px; text-align: center; font-weight: bold; display: none; }
.bms-response.success { background-color: #d4edda; color: #155724; }
.bms-response.error { background-color: #f8d7da; color: #721c24; }
.delete-text { color: #dc3545; cursor: pointer; font-weight: bold; }

/* --- Responsive Design --- */
@media (min-width: 600px) {
    .bms-payment-form-wrapper .form-grid { grid-template-columns: 1fr 1fr; }
    .bms-dashboard-wrapper .bms-controls { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
    .bms-card-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 768px) {
    .bms-card-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}