/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    --mx-bg: #f4f7f6;
    --mx-card-bg: #ffffff;
    --mx-text: #2c3e50;
    --mx-primary: #007bff;
    --mx-danger: #ff4757;
    --mx-success: #2ed573;
    --mx-warning: #ffa502;
    --mx-pink: #ff6b81;
    --mx-dark: #2f3542;
}

body.mx-canvas-mode {
    margin: 0 !important; padding: 0 !important;
    background: var(--mx-bg) !important;
    height: 100vh !important; width: 100vw !important;
    position: fixed !important; top: 0 !important; left: 0 !important;
    overflow: hidden !important; z-index: 999999;
}
body.mx-canvas-mode #wpadminbar, body.mx-canvas-mode header, body.mx-canvas-mode footer { display: none !important; }

.mx-app-wrapper {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--mx-bg); z-index: 99999999;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--mx-text); display: flex; flex-direction: column;
}
.mx-app-wrapper.dark-mode { --mx-bg: #121212; --mx-card-bg: #1e272e; --mx-text: #dcdde1; }

/* =========================================
   2. AUTH SCREEN (COLORFUL CARD UI)
   ========================================= */
.mx-auth-screen { 
    width: 100%; height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--mx-primary), var(--mx-pink), var(--mx-success));
    background-size: 300% 300%; animation: gradientBG 15s ease infinite;
    padding: 20px; box-sizing: border-box;
}

.mx-auth-inner { 
    background: var(--mx-card-bg); width: 100%; max-width: 400px;
    padding: 40px 30px; border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    display: flex; flex-direction: column; align-items: center;
    backdrop-filter: blur(10px);
}

.mx-logo-area { text-align: center; margin-bottom: 25px; }
.mx-logo-icon { width: 70px; height: 70px; margin: 0 auto 15px; border-radius: 50%; background: linear-gradient(135deg, var(--mx-primary), var(--mx-pink)); color: white; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
.mx-logo-area h2 { margin: 0; font-size: 26px; font-weight: 800; color: var(--mx-text); }
.mx-logo-area p { margin: 5px 0 0; color: #7f8fa6; font-size: 14px; }

.mx-auth-tabs { display: flex; width: 100%; background: #f1f2f6; border-radius: 12px; padding: 5px; margin-bottom: 25px; }
.dark-mode .mx-auth-tabs { background: #2f3542; }
.mx-auth-tabs button { flex: 1; padding: 12px; border: none; background: transparent; font-weight: bold; color: #747d8c; cursor: pointer; border-radius: 8px; font-size: 15px; transition: 0.3s; }
.mx-auth-tabs button.active { background: white; color: var(--mx-primary); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.dark-mode .mx-auth-tabs button.active { background: #57606f; color: #fff; }

.mx-form { width: 100%; display: none; flex-direction: column; gap: 16px; }
.mx-form.active-form { display: flex; animation: fadeIn 0.4s ease; }

.input-with-icon { position: relative; width: 100%; }
.input-with-icon i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--mx-primary); z-index: 2; font-size: 18px; }
.input-with-icon input, .input-with-icon select { width: 100%; padding: 14px 14px 14px 45px; border: 2px solid transparent; border-radius: 12px; box-sizing: border-box; font-size: 15px; background: #f1f2f6; color: var(--mx-text); transition: 0.3s; outline: none; }
.dark-mode .input-with-icon input, .dark-mode .input-with-icon select { background: #2f3542; border-color: transparent; }
.input-with-icon input:focus { border-color: var(--mx-primary); background: transparent; }

.mx-gradient-btn { background: linear-gradient(90deg, var(--mx-primary), var(--mx-pink)); color: white; border: none; border-radius: 12px; font-weight: bold; cursor: pointer; font-size: 16px; padding: 15px; width: 100%; box-shadow: 0 8px 20px rgba(255, 107, 129, 0.4); transition: 0.3s; margin-top: 10px; text-transform: uppercase; letter-spacing: 1px; }
.mx-gradient-btn:hover { transform: translateY(-3px); box-shadow: 0 12px 25px rgba(255, 107, 129, 0.6); }

/* =========================================
   3. SMART DASHBOARD UI
   ========================================= */
.mx-dashboard-container { display: flex; flex-direction: column; height: 100%; width: 100%; max-width: 600px; margin: 0 auto; background: var(--mx-bg); box-shadow: 0 0 40px rgba(0,0,0,0.05); }
.mx-fixed-top-area { flex-shrink: 0; width: 100%; z-index: 10; }
.mx-slider-container { width: 100%; height: 200px; overflow: hidden; position: relative; border-radius: 0 0 30px 30px; box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
.mx-slide { width: 100%; height: 100%; background-size: cover; background-position: center; position: absolute; top: 0; left: 0; transition: transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1); }

.mx-notice-board { background: var(--mx-card-bg); margin: -20px 20px 15px; padding: 12px 15px; border-radius: 12px; display: flex; align-items: center; box-shadow: 0 5px 15px rgba(0,0,0,0.08); position: relative; z-index: 20; border-left: 5px solid var(--mx-warning); font-size: 14px; font-weight: 500; }
.notice-icon { margin-right: 15px; color: var(--mx-warning); font-size: 18px; }

.mx-user-card { display: flex; justify-content: space-between; align-items: center; background: var(--mx-card-bg); padding: 15px 20px; margin: 0 20px 20px; border-radius: 16px; box-shadow: 0 8px 20px rgba(0,0,0,0.05); }
.user-details { display: flex; align-items: center; gap: 15px; }
.user-avatar { width: 45px; height: 45px; background: linear-gradient(135deg, var(--mx-primary), var(--mx-success)); border-radius: 12px; display: flex; align-items: center; justify-content: center; color: white; font-size: 20px; box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.user-name { font-size: 16px; color: var(--mx-text); }
.user-actions button { background: #f1f2f6; border: none; width: 40px; height: 40px; border-radius: 50%; color: var(--mx-dark); cursor: pointer; font-size: 16px; margin-left: 10px; transition: 0.3s; }
.dark-mode .user-actions button { background: #2f3542; color: white; }
.user-actions button:hover { background: var(--mx-danger); color: white; }

.mx-scrollable-menu-area { flex-grow: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 10px; }
.mx-grid-menu { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; padding: 10px; }
.mx-grid-item { background: var(--mx-card-bg); padding: 20px 10px; border-radius: 20px; display: flex; flex-direction: column; align-items: center; text-align: center; cursor: pointer; box-shadow: 0 6px 15px rgba(0,0,0,0.04); transition: 0.3s; }
.mx-grid-item:active { transform: scale(0.95); }
.mx-icon-circle { width: 55px; height: 55px; background: rgba(0, 123, 255, 0.08); border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 26px; margin-bottom: 12px; }
.dark-mode .mx-icon-circle { background: rgba(255, 255, 255, 0.05); }
.mx-item-title { font-size: 13px; font-weight: 600; color: var(--mx-text); }

/* =========================================
   4. CUSTOM MODALS (SMART UI)
   ========================================= */
.mx-modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 100000; align-items: center; justify-content: center; backdrop-filter: blur(5px); }
.mx-modal-box { background: var(--mx-card-bg); width: 90%; max-width: 400px; border-radius: 20px; box-shadow: 0 25px 50px rgba(0,0,0,0.3); animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); overflow: hidden; }
.mx-modal-header { padding: 20px; font-weight: 800; font-size: 18px; border-bottom: 1px solid rgba(0,0,0,0.05); display: flex; justify-content: space-between; align-items: center; }
.mx-modal-body { padding: 30px 20px; text-align: center; font-size: 15px; color: var(--mx-text); line-height: 1.6; }
.mx-modal-footer { padding: 15px 20px; display: flex; justify-content: flex-end; gap: 10px; background: rgba(0,0,0,0.02); border-top: 1px solid rgba(0,0,0,0.05); }
.mx-modal-close { cursor: pointer; color: var(--mx-danger); background: rgba(255, 71, 87, 0.1); width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; }

/* =========================================
   5. FULL ADMIN PANEL FIXES (DETAILED)
   ========================================= */
.mx-worker-panel { 
    background: #ffffff; 
    padding: 20px; 
    border-radius: 12px; 
    box-shadow: 0 5px 20px rgba(0,0,0,0.08); 
    overflow: visible; 
    margin-bottom: 50px; 
    position: relative; 
    box-sizing: border-box; 
    width: 100%;
}
.mx-panel-header { margin-bottom: 25px; border-bottom: 2px solid #f0f0f0; padding-bottom: 15px; }
.mx-panel-header h2 { margin: 0; font-size: 22px; color: var(--mx-dark); display: flex; align-items: center; gap: 10px; }

/* Tabs Row Fixes */
.mx-worker-tabs { display: flex; gap: 8px; margin-bottom: 25px; flex-wrap: wrap; border-bottom: 2px solid #eee; }
.w-tab { 
    padding: 12px 15px; 
    background: #f8f9fa; 
    border: 1px solid #ddd; 
    border-bottom: none; 
    cursor: pointer; 
    border-radius: 8px 8px 0 0; 
    font-weight: 600; 
    color: #555; 
    transition: 0.3s; 
    flex-grow: 1; 
    text-align: center; 
    font-size: 14px;
}
.w-tab.active { background: var(--mx-primary); color: white; border-color: var(--mx-primary); }

.w-section { display: none; }
.w-section.active { display: block; animation: fadeIn 0.3s; }

/* Cards inside Admin Panel */
.mx-card { background: #fff; border: 1px solid #eee; border-radius: 8px; margin-bottom: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.02); }
.mx-card-header { background: #fafafa; padding: 15px 20px; font-weight: bold; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; border-radius: 8px 8px 0 0; font-size: 16px; }
.mx-card-body { padding: 20px; }

/* Inputs and Forms */
.mx-input, .mx-select, .mx-input-small { 
    width: 100%; 
    padding: 12px 15px; 
    border: 1px solid #ddd; 
    border-radius: 6px; 
    box-sizing: border-box; 
    font-size: 14px; 
    outline: none; 
    transition: 0.3s; 
}
.mx-input:focus, .mx-select:focus { border-color: var(--mx-primary); box-shadow: 0 0 5px rgba(0,123,255,0.2); }
.mx-input-small { width: auto; min-width: 150px; flex: 1; }

.form-row { display: flex; gap: 15px; flex-wrap: wrap; }
.form-group { flex: 1; margin-bottom: 15px; min-width: 200px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 14px; color: #444; }

/* Table Responsiveness Fix (Prevents Squishing) */
.table-responsive { 
    width: 100%; 
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch; 
    border: 1px solid #eee; 
    border-radius: 8px; 
    display: block; /* Important for scroll */
}
.mx-table { width: 100%; border-collapse: collapse; min-width: 800px; }
.mx-table th, .mx-table td { padding: 15px; border-bottom: 1px solid #eee; text-align: left; font-size: 14px; vertical-align: middle; }
.mx-table th { background: #f8f9fa; color: #333; font-weight: 700; white-space: nowrap; }
.mx-table tr:hover { background: #fdfdfd; }

/* Buttons global */
.mx-btn { padding: 10px 15px; border: none; border-radius: 6px; cursor: pointer; color: white; font-size: 13px; font-weight: bold; display: inline-flex; align-items: center; justify-content: center; gap: 5px; transition: 0.2s; }
.btn-save { background: var(--mx-primary); }
.btn-danger { background: var(--mx-danger); }
.btn-warn { background: var(--mx-warning); color: #fff; }
.btn-success { background: var(--mx-success); }
.mx-btn:hover { opacity: 0.9; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }

/* Badges and Icon Grid */
.mx-status-badge { font-size: 11px; padding: 5px 10px; border-radius: 20px; text-transform: uppercase; font-weight: bold; letter-spacing: 0.5px; }
.status-active { background: rgba(46, 213, 115, 0.2); color: #2ed573; }
.status-pending { background: rgba(255, 165, 2, 0.2); color: #ffa502; }
.status-locked { background: rgba(255, 71, 87, 0.2); color: #ff4757; }

.mx-icon-grid { display: flex; flex-wrap: wrap; gap: 10px; max-height: 200px; overflow-y: auto; padding: 15px; border: 1px solid #eee; margin-top: 10px; background: #fafafa; border-radius: 8px; }
.mx-icon-option { width: 45px; height: 45px; display: flex; align-items: center; justify-content: center; border: 1px solid #ddd; cursor: pointer; border-radius: 8px; background: #fff; font-size: 18px; transition: 0.2s; }
.mx-icon-option:hover, .mx-icon-option.selected { background: var(--mx-primary); color: white; border-color: var(--mx-primary); }

.mx-role-checkboxes { display: flex; flex-wrap: wrap; gap: 15px; }
.mx-role-check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes gradientBG { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }