/* CSS Styles */
:root {
    --color-primary: #6C5CE7;
    --color-danger: #FF7782;
    --color-success: #41f1b6;
    --color-warning: #ffbb55;
    --color-white: #fff;
    --color-info-dark: #7d8da1;
    --color-info-light: #dce1eb;
    --color-dark: #363949;
    --color-light: rgba(132, 139, 200, 0.18);
    --color-dark-variant: #677483;
    --color-background: #f6f6f9;

    --card-border-radius: 2rem;
    --border-radius-1: 0.4rem;
    --border-radius-2: 0.8rem;
    --border-radius-3: 1.2rem;

    --card-padding: 1.8rem;
    --padding-1: 1.2rem;

    --box-shadow: 0 2rem 3rem var(--color-light);
}

* {
    margin: 0;
    padding: 0;
    outline: 0;
    appearance: none;
    border: 0;
    text-decoration: none;
    list-style: none;
    box-sizing: border-box;
}

html {
    font-size: 14px;
}

body {
    width: 100vw;
    font-family: 'Poppins', sans-serif;
    font-size: 0.88rem;
    background: var(--color-background);
    overflow-x: hidden;
    color: var(--color-dark);
}

.container {
    display: grid;
    width: 96%;
    margin: 0 10px;
    gap: 1.8rem;
    grid-template-columns: 18rem auto 1rem;
}

a {
    color: var(--color-dark);
}

h1, h2, h3, h4, h5 {
    font-weight: 600;
}
h1 { font-size: 1.8rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 0.87rem; }
.text-muted { color: var(--color-info-dark); }
.success { color: var(--color-success); }
.danger { color: var(--color-danger); }

/* --- Sidebar --- */
aside {
    height: 100vh;
    background: var(--color-white);
    border-right: 1px solid var(--color-light);
    border-top-right-radius: var(--card-border-radius);
    border-bottom-right-radius: var(--card-border-radius);
    box-shadow: var(--box-shadow);
}

aside .top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.4rem;
    padding: 0 1rem;
}
aside .logo {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}
aside .logo h2 {
    color: var(--color-primary);
    font-size: 1.2rem;
}
aside .close {
    display: none;
}
aside .sidebar {
    display: flex;
    flex-direction: column;
    height: 86vh;
    position: relative;
    top: 3rem;
}
aside .sidebar a {
    display: flex;
    color: var(--color-info-dark);
    /* padding-left: 2rem; এই লাইনটি সরানো হয়েছে */
    gap: 1rem;
    align-items: center;
    position: relative;
    height: 3.7rem;
    transition: all 300ms ease;
    border-radius: var(--border-radius-2);
}
aside .sidebar a span {
    font-size: 1.6rem;
    transition: all 300ms ease;
}
aside .sidebar a.active {
    background: var(--color-light);
    color: var(--color-primary);
    /* padding-left: 2rem; এই লাইনটি সরানো হয়েছে */
}
aside .sidebar a.active::before {
    content: '';
    width: 6px;
    height: 100%;
    background: var(--color-primary);
    position: absolute;
    left: 0;
    top: 0;
    border-radius: 0 var(--border-radius-1) var(--border-radius-1) 0;
}
aside .sidebar a:hover {
    color: var(--color-primary);
    background: var(--color-light);
    /* padding-left: 2.5rem; এই লাইনটি সরানো হয়েছে */
}
aside .sidebar a.active:hover {
    background: var(--color-light);
    color: var(--color-primary);
    /* padding-left: 2rem; এই লাইনটি সরানো হয়েছে */
}
aside .sidebar a.logout {
    position: absolute;
    bottom: 2rem;
    width: 100%;
}
aside .sidebar a.logout:hover {
    /* padding-left: 2.5rem; এই লাইনটি সরানো হয়েছে */
}

/* --- Main Content --- */
main {
    margin-top: 1.4rem;
}

main .stats_cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.6rem;
}

main .stats_cards .card {
    background: var(--color-white);
    padding: var(--card-padding);
    border-radius: var(--border-radius-2);
    box-shadow: var(--box-shadow);
    transition: all 300ms ease;
}
main .stats_cards .card:hover {
    box-shadow: none;
}
main .stats_cards .card h3 {
    color: var(--color-info-dark);
}
main .stats_cards .card h1 {
    font-size: 2.2rem;
}

.charts_section {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.6rem;
}
.chart-container {
    background: var(--color-white);
    padding: var(--card-padding);
    border-radius: var(--card-border-radius);
    box-shadow: var(--box-shadow);
    height: 450px;
}
.recent_activity {
    margin-top: 2rem;
}
.recent_activity h2 {
    margin-bottom: 0.8rem;
}
.recent_activity table {
    background: var(--color-white);
    width: 100%;
    border-radius: var(--card-border-radius);
    padding: var(--card-padding);
    text-align: left;
    box-shadow: var(--box-shadow);
    transition: all 300ms ease;
}
.recent_activity table:hover {
    box-shadow: none;
}
.recent_activity tbody td {
    height: 2.8rem;
    border-bottom: 1px solid var(--color-light);
}
.recent_activity tbody tr:last-child td {
    border: none;
}

/* --- Right / Top bar --- */
.right {
    margin-top: 1.4rem;
}
.right .top {
    display: flex;
    justify-content: flex-end;
    gap: 2rem;
}
.right .top button {
    display: none;
}
.right .top .profile {
    display: flex;
    gap: 2rem;
    text-align: right;
}

/* =================== MEDIA QUERIES (MOBILE) =================== */
@media screen and (max-width: 768px) {
    .container {
        width: 100%;
        grid-template-columns: 1fr;
        padding: 0 1rem;
    }

    /* সাইডবার */
    aside {
        position: fixed;
        left: -100%;
        background: var(--color-white);
        width: 18rem;
        z-index: 3;
        box-shadow: 1rem 3rem 4rem var(--color-light);
        height: 100vh;
        padding-right: var(--card-padding);
        transition: all 0.4s ease;
        border-right: none;
        border-radius: 0;
    }
    aside.show {
        left: 0;
    }
    aside .logo h2 {
        display: inline;
    }
    aside .close {
        display: inline-block;
        cursor: pointer;
    }
    aside .sidebar a {
        /* padding-left: 2rem; এই লাইনটি সরানো হয়েছে */
    }
    aside .sidebar a.active {
        /* padding-left: 2rem; এই লাইনটি সরানো হয়েছে */
    }
    aside .sidebar a:hover,
    aside .sidebar a.logout:hover {
        /* padding-left: 2.5rem; এই লাইনটি সরানো হয়েছে */
    }
    
    /* মেইন কন্টেন্ট */
    main {
        margin-top: 6rem;
        padding: 0 1rem;
    }
    main .stats_cards,
    .charts_section {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-top: 1rem;
    }
    main h1 { font-size: 1.5rem; }
    main h2 { font-size: 1.2rem; }
    main h3 { font-size: 0.8rem; }
    
    .recent_activity {
        width: 100%;
        margin-top: 1rem;
    }
    
    /* টপ বার */
    .right {
        position: absolute;
        top: 0;
        left: 0;
        height: 4.6rem;
        width: 100%;
        margin: 0;
        padding: 0 1rem;
        background: var(--color-white);
        z-index: 2;
        box-shadow: 0 1rem 1rem var(--color-light);
    }
    .right .top {
        position: fixed;
        top: 0;
        left: 0;
        align-items: center;
        padding: 0 1.2rem;
        height: 4.6rem;
        background: var(--color-white);
        width: 100%;
        margin: 0;
        z-index: 2;
    }
    .right .top button {
        display: inline-block;
        background: transparent;
        cursor: pointer;
        color: var(--color-dark);
        position: absolute;
        left: 1rem;
    }
    .right .top .profile {
        position: absolute;
        right: 1rem;
    }
    .chart-container {
        position: relative;
        height: 250px;
    }
}


/* ================================================================
   ========== STYLES FOR USER MANAGEMENT PAGE ==========
   ================================================================ */

/* Action Bar Styles */
.action-bar {
    display: flex;
    flex-wrap: wrap; /* This makes it responsive */
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin: 1rem 0 2rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.4rem;
    border-radius: var(--border-radius-2);
    cursor: pointer;
    transition: all 300ms ease;
    font-weight: 500;
    white-space: nowrap; /* Prevents button text from wrapping */
}

.btn.btn-primary {
    background: var(--color-primary);
    color: var(--color-white);
}

.btn.btn-primary:hover {
    opacity: 0.85;
}

.search-wrapper {
    display: flex;
    align-items: center;
    background: var(--color-white);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-2);
    box-shadow: var(--box-shadow);
    gap: 0.5rem;
}

.search-wrapper input[type="search"] {
    background: transparent;
    width: 250px;
    transition: width 300ms ease;
}

/* Table Wrapper for Responsive Scrolling */
.table-wrapper {
    width: 100%;
    overflow-x: auto; /* This is the key for table responsiveness */
    border-radius: var(--border-radius-2);
    background: var(--color-white);
    padding: var(--card-padding);
    box-shadow: var(--box-shadow);
}

.table-wrapper table {
    width: 100%;
    min-width: 800px; /* Forces horizontal scroll on smaller screens */
    border-collapse: collapse;
    text-align: left;
}
.table-wrapper table thead th {
    font-weight: 600;
    color: var(--color-info-dark);
    padding-bottom: 1rem;
    white-space: nowrap;
}
.table-wrapper table tbody td {
    height: 3.5rem;
    border-top: 1px solid var(--color-light);
    color: var(--color-dark-variant);
    white-space: nowrap;
}
.table-wrapper table tbody tr:first-child td {
    border-top: none;
}


.user-name {
    font-weight: 600;
    color: var(--color-dark);
}
.user-email {
    color: var(--color-info-dark);
    font-size: 0.8rem;
}

.status {
    padding: 0.4rem 0.8rem;
    border-radius: var(--border-radius-1);
    color: var(--color-white);
    font-size: 0.75rem;
    font-weight: 600;
}
.status.active {
    background: var(--color-success);
}
.status.inactive {
    background: var(--color-danger);
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: 0.8rem; /* Increased gap for better spacing */
}

.btn-icon {
    background: var(--color-light);
    border-radius: var(--border-radius-1);
    cursor: pointer;
    padding: 0.6rem; /* Adjusted padding for a better look */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 300ms ease;
}
.btn-icon .material-icons-sharp {
    font-size: 1.2rem;
    color: var(--color-dark-variant);
}
.btn-icon:hover {
    background: var(--color-primary);
}
.btn-icon:hover .material-icons-sharp {
    color: var(--color-white);
}

/* Optional: Add specific hover colors for delete and view buttons */
.btn-icon.delete:hover {
    background: var(--color-danger);
}
.btn-icon.view:hover {
    background: var(--color-success);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.show-modal {
    display: flex;
}

.modal-content {
    background: var(--color-white);
    padding: 2rem;
    border-radius: var(--border-radius-2);
    width: 100%;
    max-width: 500px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    cursor: pointer;
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: var(--color-primary);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* This new rule targets all form elements for a consistent look */
.form-group input,
.form-group textarea,
.form-group select,
.filter-select {
    width: 100%;
    padding: 0.8rem;
    border-radius: var(--border-radius-1);
    background: var(--color-background);
    border: 1px solid var(--color-light);
    font-family: 'Poppins', sans-serif;
    font-size: 0.88rem;
}

/* To ensure select dropdowns in forms also look good */
.form-group .filter-select {
    padding: 0.75rem; /* slight adjustment for select */
}

.modal-content .btn {
    width: 100%;
    margin-top: 1rem;
    padding: 1rem;
}

/* ================================================================
   ========== MOBILE RESPONSIVE FOR USER MANAGEMENT PAGE ==========
   ================================================================ */

@media screen and (max-width: 768px) {
    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-wrapper input[type="search"] {
        width: 100%;
    }

    .table-wrapper {
        padding: 0;
        box-shadow: none;
    }

    .table-wrapper table {
        box-shadow: var(--box-shadow);
        border-radius: var(--border-radius-2);
        padding: var(--card-padding);
    }
}

/* ================================================================
   ========== STYLES FOR DEVICE MANAGEMENT PAGE ==========
   ================================================================ */

.page-description {
    margin: -0.5rem 0 2rem;
    color: var(--color-info-dark);
}

.device-status {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.device-status.online {
    color: var(--color-success);
}
.device-status.online .status-dot {
    background: var(--color-success);
}

.device-status.offline {
    color: var(--color-danger);
}
.device-status.offline .status-dot {
    background: var(--color-danger);
}


/* ================================================================
   ========== STYLES FOR MESSAGE HUB PAGE ==========
   ================================================================ */

.filter-select {
    background: var(--color-white);
    padding: 0.7rem 1rem;
    border-radius: var(--border-radius-2);
    box-shadow: var(--box-shadow);
    color: var(--color-dark-variant);
    font-family: 'Poppins', sans-serif;
}

.message-content {
    max-width: 250px; /* Maximum width for the message column */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Adds "..." for long text */
    cursor: help; /* Shows a help cursor on hover */
}

/* New Status badge styles */
.status.sent {
    background: var(--color-success);
}
.status.failed {
    background: var(--color-danger);
}
.status.pending {
    background: var(--color-warning);
}


/* ================================================================
   ========== STYLES FOR SUBSCRIPTION PLANS PAGE ==========
   ================================================================ */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.plan-card-admin {
    background: var(--color-white);
    border-radius: var(--border-radius-2);
    box-shadow: var(--box-shadow);
    padding: var(--card-padding);
    display: flex;
    flex-direction: column;
    transition: all 300ms ease;
}
.plan-card-admin:hover {
    box-shadow: none;
}

.plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-light);
    padding-bottom: 1rem;
}
.plan-header h3 {
    font-size: 1.1rem;
}

.plan-pricing {
    padding: 1.5rem 0;
    text-align: center;
}
.plan-pricing .price {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

.plan-features {
    flex-grow: 1; /* Makes sure cards have same height */
    margin-bottom: 1.5rem;
}
.plan-features li {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
    color: var(--color-dark-variant);
}
.plan-features li .material-icons-sharp {
    color: var(--color-success);
    font-size: 1.2rem;
}
.plan-features li .material-icons-sharp.close {
    color: var(--color-danger);
}


.plan-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: auto; /* Pushes actions to the bottom */
}
/* Replace the previous .plan-pricing-tiers styles with this */

.plan-pricing {
    padding: 1.5rem 0;
    text-align: center;
    font-size: 1.1rem;
    color: var(--color-dark-variant);
}
.plan-pricing .price {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

/* New style for inline form groups in modal */
.form-group-inline {
    display: flex;
    gap: 1rem;
}
.form-group-inline .form-group {
    flex: 1;
}

/* ================================================================
   ========== STYLES FOR DELETE CONFIRMATION MODAL ==========
   ================================================================ */
.modal-content .text-danger {
    color: var(--color-danger);
}

.modal-content p {
    margin: 0.5rem 0 1.5rem;
    color: var(--color-info-dark);
}

.confirmation-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.btn.btn-secondary {
    background: #ccc;
    color: var(--color-dark);
}
.btn.btn-secondary:hover {
    background: var(--color-info-dark);
    color: var(--color-white);
}

.btn.btn-danger {
    background: var(--color-danger);
    color: var(--color-white);
}
.btn.btn-danger:hover {
    opacity: 0.8;
}
/* ================================================================
   ========== STYLES FOR MODAL CHECKBOX FEATURES ==========
   ================================================================ */

.checkbox-group {
    display: flex;
    gap: 2rem;
    margin: 1.5rem 0;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-container input[type="checkbox"] {
    appearance: auto; /* এই লাইনটি চেকবক্সকে আবার দৃশ্যমান করবে */
    width: 18px;
    height: 18px;
    cursor: pointer;
    position: relative;
    top: -2px; /* টেক্সটের সাথে সুন্দরভাবে মেলানোর জন্য */
}
/* ================================================================
   ========== STYLES FOR PAYMENT METHODS PAGE (FINAL DESIGN) ==========
   ================================================================ */

.payment-methods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.payment-card-v2 {
    background: var(--color-white);
    padding: 1.5rem;
    border-radius: var(--border-radius-2);
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 300ms ease;
}
.payment-card-v2:hover {
    box-shadow: none;
}

.payment-logo-large {
    height: 40px;
    max-width: 150px;
    object-fit: contain;
    margin-bottom: 1rem;
}

.method-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    flex-grow: 1; /* Pushes actions to the bottom */
}

.card-actions {
    display: flex;
    gap: 1rem;
    justify-content: space-between; /* Puts space between toggle and button */
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--color-light);
    width: 100%;
}


/* Toggle Switch Styles */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    appearance: auto;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--color-success);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* ================================================================
   ========== STYLES FOR PAYMENT SETTINGS MODAL ==========
   ================================================================ */

.modal-method-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--color-light);
    padding: 1rem;
    border-radius: var(--border-radius-1);
    margin-bottom: 1.5rem;
    border: 1px solid var(--color-info-light);
}

.modal-method-info img {
    height: 30px;
    width: 30px;
    object-fit: contain;
}

.modal-method-info h2 {
    font-size: 1.2rem;
    margin: 0;
}

/* ================================================================
   ========== STYLES FOR PAYMENT HISTORY PAGE ==========
   ================================================================ */

/* New Status badge style for 'Completed' */
.status.completed {
    background: var(--color-success);
}

/* We can reuse .failed and .pending from message hub styles */
/* If they don't exist, you can add them: */
/*
.status.failed {
    background: var(--color-danger);
}
.status.pending {
    background: var(--color-warning);
}
*/


/* ================================================================
   ========== STYLES FOR VIEW PAYMENT DETAILS MODAL ==========
   ================================================================ */

.payment-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-light);
    padding-bottom: 1.5rem;
}
.payment-details-grid div {
    font-size: 0.9rem;
}
.payment-details-grid div strong {
    color: var(--color-dark);
    display: block;
    margin-bottom: 0.2rem;
}

.payment-screenshot strong {
    display: block;
    margin-bottom: 0.8rem;
}
.payment-screenshot img {
    max-width: 100%;
    border-radius: var(--border-radius-1);
    border: 1px solid var(--color-light);
}

.modal-content .confirmation-buttons {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-light);
}

.btn.btn-success {
    background: var(--color-success);
    color: var(--color-white);
}
.btn.btn-success:hover {
    opacity: 0.8;
}
/* ================================================================
   ========== STYLES FOR SYSTEM SETTINGS PAGE (TAB STYLE) ==========
   ================================================================ */

.settings-tabs-container {
    background: var(--color-white);
    border-radius: var(--border-radius-2);
    box-shadow: var(--box-shadow);
    margin-top: 2rem;
}

.tabs-nav {
    display: flex;
    border-bottom: 1px solid var(--color-light);
}

.tab-btn {
    padding: 1rem 1.5rem;
    cursor: pointer;
    background: transparent;
    border-bottom: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-info-dark);
    transition: all 300ms ease;
}

.tab-btn:hover {
    background: var(--color-light);
}

.tab-btn.active {
    border-bottom-color: var(--color-primary);
    color: var(--color-primary);
}

.tabs-content {
    padding: var(--card-padding);
}

.tab-pane {
    display: none; /* Hide all panes by default */
}

.tab-pane.active {
    display: block; /* Show only the active pane */
}

/* Custom File Input */
.file-input-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.file-input {
    display: none;
}
.file-input-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.2rem;
    background: var(--color-light);
    border-radius: var(--border-radius-1);
    cursor: pointer;
}
.file-input-label:hover {
    background: var(--color-primary);
    color: var(--color-white);
}
.file-name {
    color: var(--color-info-dark);
}

.save-button-container {
    display: flex;
    justify-content: flex-end;
    padding: 0 var(--card-padding) var(--card-padding);
}
.save-button-container .btn {
    padding: 0.8rem 2rem;
}