/* --- Variable Definitions --- */
:root {
    --bg-color: #0d1117;
    --card-color: #161b22;
    --border-color: #30363d;
    --text-color: #c9d1d9;
    --text-muted-color: #8b949e;
    --primary-color: #2ea043;
    --primary-hover-color: #35b84d;
    --danger-color: #da3633;
    --danger-hover-color: #f85149;
    --input-bg-color: #010409;
    /* New Switch Colors */
    --switch-on-bg: #1c4a45;
    --switch-on-thumb: #33d5b4;
    --switch-off-border: #3b424c;
}

/* --- General --- */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
    margin: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Layout --- */
.page-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 30px;
}

/* --- Navbar Styles --- */
.navbar {
    background-color: var(--card-color);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 0; /* Adjusted padding slightly */
    margin-bottom: 40px;
}
.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 auto;
}
.logo a {
    /* Removed old text styles */
    text-decoration: none;
    display: inline-block; /* Needed for vertical alignment */
}

/* --- New Logo Image Style --- */
.navbar-logo {
    height: 50px; /* Adjust height as needed */
    width: auto; /* Maintain aspect ratio */
    vertical-align: middle; /* Align vertically with nav links */
}
/* --- End New Logo Style --- */

.nav-links a {
    color: var(--text-muted-color);
    text-decoration: none;
    margin-left: 25px;
    font-weight: 500;
    transition: color 0.2s;
}
.nav-links a:hover, .nav-links a.active {
    color: var(--text-color);
}


/* --- Card Styles --- */
.card {
    background-color: var(--card-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 24px;
}
.card-header {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
}

/* --- Form Styles --- */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}
.form-group input, .form-group select {
    background-color: var(--input-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    padding: 10px 12px;
    width: 100%;
    box-sizing: border-box;
    font-size: 14px;
}
/* Apply focus styles to select as well */
.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 160, 67, 0.3);
}

/* --- Button Styles --- */
.btn {
    display: inline-block;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.2s;
}
.btn-primary {
    background-color: var(--primary-color);
    color: white;
    width: 100%;
}
.btn-primary:hover {
    background-color: var(--primary-hover-color);
}
.btn-danger {
    background-color: var(--danger-color);
    color: white;
}
.btn-danger:hover {
    background-color: var(--danger-hover-color);
}


/* --- Account List Styles --- */
.account-list-item, .bot-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}
.account-list-item:last-child, .bot-list-item:last-child {
    border-bottom: none;
}
.account-info {
    flex-grow: 1; /* Allow info to take available space */
    margin-right: 15px; /* Add space between info and actions */
}
.account-info h4, .bot-info h4 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
}
.account-info p, .bot-info p {
    margin: 0;
    color: var(--text-muted-color);
    font-size: 12px;
}
.account-actions, .bot-actions {
    display: flex;
    align-items: center;
    gap: 15px; /* Consistent gap */
    flex-shrink: 0; /* Prevent actions from shrinking */
}

/* --- Flash Message Styles --- */
.flash-message {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 6px;
    border: 1px solid transparent;
}
.flash-message.success {
    color: #0f5132;
    background-color: #d1e7dd;
    border-color: #badbcc;
}
.flash-message.danger {
    color: #842029;
    background-color: #f8d7da;
    border-color: #f5c2c7;
}

/* --- Account Type Badge Styles --- */
.account-type-badge {
    font-size: 10px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 12px;
    margin-left: 8px;
    vertical-align: middle;
    text-transform: uppercase;
}
.account-type-badge.main {
    background-color: rgba(46, 160, 67, 0.2);
    color: var(--primary-color);
}
.account-type-badge.follower {
    background-color: rgba(88, 166, 255, 0.2);
    color: #58a6ff;
}

/* --- Balance Update Flash Effect --- */
@keyframes flash {
    0% { background-color: transparent; }
    50% { background-color: rgba(46, 160, 67, 0.3); }
    100% { background-color: transparent; }
}
strong.flash {
    animation: flash 0.7s ease-out;
    border-radius: 4px;
    padding: 0 4px;
}

/* --- General Toggle Switch Styles --- */
.switch {
    position: relative;
    display: inline-block;
    width: 50px; /* Standard width */
    height: 24px;
    flex-shrink: 0;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--card-color);
    border: 1px solid var(--switch-off-border);
    transition: .3s;
    border-radius: 24px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-muted-color);
    transition: .3s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--switch-on-bg);
    border-color: var(--switch-on-bg);
}
input:checked + .slider:before {
    background-color: var(--switch-on-thumb);
    transform: translateX(26px); /* Adjusted translation for 50px width */
}

/* --- Condition Item / Generic Toggle Item --- */
.condition-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0; /* Remove default form-group margin */
}
.condition-item:last-child {
    border-bottom: none;
}
.condition-item span {
    font-size: 14px;
    color: var(--text-color);
    margin-right: 15px;
}


/* --- Compare Page Styles (New UI) --- */
.compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.compare-card {
    display: flex;
    flex-direction: column;
}

.compare-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end; /* Align to bottom */
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.compare-header .form-group {
    flex-grow: 1;
    margin-bottom: 0;
}

.compare-header .trade-count {
    margin-left: 20px;
    font-size: 14px;
    color: var(--text-muted-color);
    white-space: nowrap; /* Prevent wrapping */
}

.compare-header .trade-count strong {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin-left: 8px;
}

.compare-trade-list {
    display: grid;
    grid-template-columns: 1fr; /* এক কলামে ট্রেড লিস্ট */
    gap: 15px;
    overflow-y: auto;
    /* max-height: 60vh; Removed max-height, let card grow */
    min-height: 100px; /* Give some initial height */
}
.compare-trade-list .placeholder {
    color: var(--text-muted-color);
    text-align: center;
    padding: 40px 0;
    font-size: 14px;
}
.compare-trade-list .placeholder.error {
    color: var(--danger-color);
}


.compare-trade-item {
    background-color: var(--input-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px 15px;
}

.compare-trade-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.compare-trade-header .symbol {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.compare-trade-header .trade-side {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.compare-trade-header .trade-side.long {
    color: #1a8a4a;
    background-color: rgba(22, 119, 68, 0.2);
}

.compare-trade-header .trade-side.short {
    color: #e54e4e;
    background-color: rgba(218, 54, 51, 0.15);
}

.compare-trade-details {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping */
    gap: 10px; /* Reduced gap */
    font-size: 12px;
    color: var(--text-muted-color);
    margin-bottom: 12px;
}

.compare-trade-details span {
    background-color: var(--card-color);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color); /* Added border */
}

.compare-trade-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 32px; /* Ensure footer has height even without button */
}

.compare-trade-footer .margin-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
}

/* Close button style (kept for potential future use, but button removed from HTML) */
.compare-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background-color: var(--danger-color);
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.compare-close-btn:hover {
    background-color: var(--danger-hover-color);
}

.compare-close-btn:disabled {
    background-color: var(--text-muted-color);
    cursor: not-allowed;
}


/* --- Bot List Styles --- */
.status-active {
    color: var(--primary-color);
}
.status-inactive {
    color: var(--text-muted-color);
}
.bot-actions .btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 6px; /* Make it a square button */
}
.toggle-form {
    margin: 0;
}
/* Style adjustments for toggle in bot list */
.bot-actions .switch {
    width: 50px;
    height: 24px;
}
.bot-actions .slider:before {
    height: 18px;
    width: 18px;
}
.bot-actions input:checked + .slider:before {
    transform: translateX(26px);
}


/* --- Log Page Styles --- */
.log-container {
    background-color: var(--input-bg-color);
    border-radius: 6px;
    padding: 10px 20px;
    height: 60vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}
.log-item {
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    color: var(--text-muted-color);
    padding: 6px 0;
    margin: 0;
    border-bottom: 1px solid var(--border-color);
    white-space: pre-wrap;
    word-break: break-all;
}
.log-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.log-container .placeholder {
    padding-top: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
    color: var(--text-muted-color);
    font-size: 14px;
    text-align: center;
}
.log-container pre { /* Hide old pre tag if present */
    display: none;
}


/* --- Dashboard Styles --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}
.summary-card {
    display: flex;
    align-items: center;
    gap: 20px;
}
.card-icon {
    font-size: 32px;
    color: var(--primary-color);
    background-color: rgba(46, 160, 67, 0.1);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.card-content h4 {
    margin: 0 0 5px;
    color: var(--text-muted-color);
    font-size: 14px;
    font-weight: 500;
}
.card-content h2 {
    margin: 0;
    font-size: 28px;
    color: var(--text-color);
}
/* Styles for recent trades on dashboard */
.dashboard-grid + .card .trade-list { /* Select trade list only in the card after the grid */
     margin-top: 0; /* Remove extra margin if needed */
}
.dashboard-grid + .card .trade-item {
     background-color: var(--input-bg-color);
     border: 1px solid var(--border-color);
     border-radius: 6px;
     padding: 15px;
     margin-bottom: 15px;
     display: flex;
     justify-content: space-between;
     align-items: center;
}
.dashboard-grid + .card .trade-item:last-child {
     margin-bottom: 0; /* Remove margin from last item */
}
.dashboard-grid + .card .trade-info h4 {
     margin: 0 0 5px;
     font-size: 16px;
}
.dashboard-grid + .card .trade-info p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted-color);
}
.dashboard-grid + .card .trade-status span {
    font-size: 12px;
    color: var(--text-muted-color);
}


/* --- Account Page Specific Styles --- */
.account-actions .btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background-color: var(--border-color);
    border: none;
    color: var(--text-color);
    cursor: pointer;
    display: flex; /* Ensure icon is centered */
    align-items: center;
    justify-content: center;
}
.account-actions .btn-icon.btn-danger { /* Specific style for delete button */
     background-color: var(--danger-color);
     color: white;
}
.account-actions .btn-icon:hover:not(.btn-danger) { /* Hover for non-delete buttons */
    background-color: #444c56;
}
.account-actions .btn-icon.btn-danger:hover { /* Hover for delete button */
    background-color: var(--danger-hover-color);
}
.account-actions form {
    margin: 0; /* Remove default form margin */
}
/* FontAwesome spinning animation */
.fa-spin {
    animation: fa-spin 1s infinite linear;
}
@keyframes fa-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Visibility Toggle Opacity */
.visibility-toggle-label {
    transition: opacity 0.3s ease;
    cursor: pointer; /* Add cursor pointer to label */
}


/* --- Login Page Styles --- */
.login-center {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 50px;
    min-height: calc(100vh - 120px); /* Use min-height */
}

.login-card {
    width: 100%;
    max-width: 400px;
}


/* --- NEW FEATURE: Floating Status Button --- */
.floating-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050; /* Above navbar on mobile */
    background-color: var(--card-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 5px;
    transition: background-color 0.3s;
}

.status-item {
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    color: var(--text-color);
}

.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-indicator.status-active { 
    background-color: var(--primary-color);
}

.status-indicator.status-inactive { 
    background-color: var(--danger-color); 
}

/* New style for partial sync */
.status-indicator.status-partial { 
    background-color: #ffc107; /* Yellow/Amber color for warning */
}

.status-value {
    font-weight: 700;
    margin-left: 5px;
}
/* --- END NEW FEATURE --- */


/* --- Responsive Design (Media Queries) --- */
@media (max-width: 992px) {
    .page-grid,
    .compare-grid {
        grid-template-columns: 1fr;
    }
    .container {
        padding: 0 15px;
    }
}

@media (max-width: 768px) {
    body {
        /* Add padding at the bottom for fixed navbar */
        padding: 1rem 1rem 80px 1rem;
    }
    .navbar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        margin-bottom: 0;
        border-top: 1px solid var(--border-color);
        border-bottom: none;
        z-index: 1000;
        padding: 5px 0;
    }
    .nav-container {
        flex-direction: row;
        align-items: center;
        /* Ensure container respects padding */
        padding-left: 15px;
        padding-right: 15px;
    }
    .logo {
        /* Keep logo visible but potentially smaller */
         flex-shrink: 0; /* Prevent shrinking */
         margin-right: 10px; /* Add space between logo and links */
    }
     .navbar-logo {
         height: 30px; /* Slightly smaller logo on mobile */
     }

    .nav-links {
        display: flex;
        flex-grow: 1; /* Allow links to take remaining space */
        justify-content: space-around;
        align-items: center;
        /* margin-left: 10px; Removed, let justify handle spacing */
    }
    .nav-links a {
        margin: 0;
        padding: 10px 5px;
        font-size: 12px;
        text-align: center;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .card-content h2 {
        font-size: 24px;
    }
    .card-header {
        font-size: 18px;
    }
    /* Adjust account actions layout on mobile */
    .account-actions {
        gap: 8px; /* Reduce gap */
    }
    .account-actions .btn-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
     /* Adjustments for visibility toggle on mobile */
    .account-actions .visibility-toggle-label {
        margin-right: 5px; /* Reduce margin */
    }
     .account-actions .switch { /* Apply specifically inside account actions */
        width: 45px;
        height: 22px;
     }
     .account-actions .slider:before {
        height: 16px;
        width: 16px;
        bottom: 2px;
     }
     .account-actions input:checked + .slider:before {
        transform: translateX(23px); /* Adjust translation for 45px width */
     }
      /* Ensure small text below toggle doesn't wrap awkwardly */
     .account-actions div > span {
         white-space: nowrap;
     }
    /* --- NEW FEATURE: Floating Status Button (Mobile Adjustments) --- */
    .floating-status {
        bottom: 70px; /* Adjust to be above the mobile navbar */
        right: 15px;
        padding: 8px 12px;
    }
    /* --- END NEW FEATURE --- */

}