/* MPD Frontend Dashboard Styles - Modern & Clean */

:root {
    --mpd-primary: #0d6efd; /* Bootstrap Blue */
    --mpd-primary-dark: #0b5ed7;
    --mpd-secondary: #6c757d;
    --mpd-success: #198754;
    --mpd-danger: #dc3545;
    --mpd-bg: #f0f2f5; /* Facebook-like gray */
    --mpd-card-bg: #ffffff;
    --mpd-text: #212529;
    --mpd-text-muted: #65676b;
    --mpd-border: #ced0d4;
    --mpd-radius: 8px;
    --mpd-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Reset & Wrapper */
html {
    overflow-y: scroll !important;
}

body {
    overflow-x: hidden !important;
}

.mpd-dashboard-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--mpd-bg);
    color: var(--mpd-text);
    
    /* STANDARD LAYOUT - NO BREAKOUTS */
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 0 40px 0;
    box-sizing: border-box;
    line-height: 1.5;
    min-height: 100vh; 
}

.mpd-dashboard-wrapper * {
    box-sizing: border-box;
}

/* --- Header & Cover --- */
.mpd-profile-header {
    background: var(--mpd-card-bg);
    box-shadow: var(--mpd-shadow);
    margin-bottom: 20px;
    position: relative;
    
    /* Full Width of Container */
    width: 100%;
    margin: 0 0 20px 0;
    
    padding-top: 0;
    z-index: 1;
}

.mpd-cover-photo {
    height: 300px;
    background-color: #0d6efd; 
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    position: relative;
    width: 100%;
}

/* Responsive Cover Height */
@media (max-width: 1024px) {
    .mpd-cover-photo {
        height: 240px !important; /* Tablet */
        background-size: cover !important;
        background-position: center center !important;
    }
}

@media (max-width: 768px) {
    .mpd-cover-photo {
        height: 160px !important; /* Mobile */
        background-size: cover !important;
        background-position: center center !important;
    }
    
    .mpd-avatar-container {
        width: 120px;
        height: 120px;
        margin-top: -60px; /* Pull up more on mobile */
    }
}

.mpd-profile-info-bar {
    max-width: 1280px; /* Match grid width */
    width: 100%;
    margin: 0 auto;
    padding: 0 20px 20px;
    display: flex;
    align-items: flex-end;
    position: relative;
    flex-wrap: wrap;
    box-sizing: border-box;
}

/* --- Avatar & Controls (Facebook Style) --- */
.mpd-avatar-container {
    position: relative;
    margin-top: -60px;
    margin-right: 20px;
    width: 168px;
    height: 168px;
    flex-shrink: 0;
    z-index: 5;
}

.mpd-avatar-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid #fff;
    background: #fff;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer; /* Indicate clickable for edit */
}

.mpd-profile-avatar {
    /* Initial state: cover the area */
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    
    /* Prepare for JS positioning */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    /* No transition on transform for instant drag response */
    will-change: transform;

    /* Hide initially to prevent jump on load */
    opacity: 0;
    transition: opacity 0.3s ease-in;
}

/* Camera Button (Bottom Right of Circle) */
.mpd-camera-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 36px;
    height: 36px;
    background-color: #e4e6eb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: background-color 0.2s;
    z-index: 20;
    color: #050505;
    font-size: 18px;
}

.mpd-camera-btn:hover {
    background-color: #d8dadf;
}

/* Edit Controls Panel (Below Avatar) */
.mpd-edit-panel {
    position: absolute;
    top: 100%; /* Below the circle */
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
    margin-top: 10px;
    text-align: center;
    display: none; /* Hidden by default */
}

.mpd-edit-panel::before {
    content: "";
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #fff;
}

.mpd-zoom-slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.mpd-zoom-slider-container i {
    color: #65676b;
    font-size: 14px;
}

.mpd-zoom-slider {
    flex-grow: 1;
    -webkit-appearance: none;
    height: 4px;
    background: #e4e6eb; /* Lighter background */
    border-radius: 2px;
    outline: none;
    box-shadow: none; /* Remove weird shadow */
}

.mpd-zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px; /* Slightly larger */
    height: 20px;
    background: #1877f2;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 0 4px rgba(24, 119, 242, 0.2); /* Professional focus ring effect */
    border: 2px solid #fff; /* White border for contrast */
    transition: transform 0.1s;
}

.mpd-zoom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.mpd-zoom-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #1877f2;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 0 4px rgba(24, 119, 242, 0.2);
    border: 2px solid #fff;
    transition: transform 0.1s;
    border: none;
}

.mpd-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.mpd-btn-save {
    background: #1877f2;
    color: #fff;
    border: none;
    padding: 6px 20px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}

.mpd-btn-cancel {
    background: #e4e6eb;
    color: #050505;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}

.mpd-user-details {
    flex-grow: 1;
    padding-bottom: 10px;
    margin-top: 10px;
    align-self: flex-end; /* Ensure it sits at the bottom */
    position: relative;
    z-index: 2;
}

/* Mobile adjustments */
@media (max-width: 991px) {
    .mpd-profile-info-bar {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding-bottom: 20px;
    }
    
    .mpd-avatar-container {
        margin-right: 0;
        /* On mobile, the negative margin pulls it up. 
           The next element (details) will naturally follow. 
           We don't need extra margin-top usually, but let's ensure spacing. */
        margin-bottom: 10px;
    }

    .mpd-user-details {
        align-self: center;
        margin-top: 0;
    }
    
    .mpd-header-actions {
        width: 100%;
        text-align: center;
        margin-top: 10px;
    }
}


.mpd-user-details h1 {
    margin: 0;
    font-size: 32px;
    font-weight: 700;
    color: #000;
    line-height: 1.2;
}

.mpd-user-role {
    font-size: 16px;
    color: var(--mpd-text-muted);
    font-weight: 500;
}

.mpd-header-actions {
    padding-bottom: 15px;
}

.mpd-btn-logout {
    display: inline-block;
    padding: 8px 16px;
    background: #e4e6eb;
    color: #000;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: background 0.2s;
}

.mpd-btn-logout:hover {
    background: #d8dadf;
    color: #000;
}

/* --- Grid Layout --- */
.mpd-dashboard-grid {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr); /* Fixed Sidebar + Flexible Content */
    gap: 30px;
    width: 100%;
    max-width: 1280px !important;
    margin: 0 auto;
    padding: 0 20px;
    align-items: start;
    min-height: 800px;
    box-sizing: border-box;
}

.mpd-sidebar {
    width: 320px !important;
    min-width: 320px !important; /* Force fixed width */
    flex-shrink: 0;
}

.mpd-main-content {
    width: 100%;
    min-width: 0; /* Prevent grid blowout */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Ensure all sections fill the grid column */
.mpd-settings-container, 
#mpd-payments-section, 
#mpd-events-section, 
#mpd-polls-section, 
#mpd-wall-section,
#mpd-wall-feed {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    flex-grow: 1;
}

.mpd-settings-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

@media (max-width: 1024px) { /* Increased breakpoint for Tablets */
    .mpd-dashboard-grid {
        grid-template-columns: 1fr !important; /* Stack layout */
        padding: 0 15px;
        gap: 20px;
    }
    
    .mpd-sidebar {
        width: 100% !important;
        min-width: 0 !important;
        margin-bottom: 20px;
    }

    .mpd-profile-info-bar {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 0 15px 20px;
    }
    
    .mpd-avatar-container {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .mpd-header-actions {
        width: 100%;
        text-align: center;
        margin-top: 10px;
    }
}

/* --- Widgets & Cards --- */
.mpd-feed {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.mpd-widget-card, .mpd-post-card {
    background: var(--mpd-card-bg);
    border-radius: var(--mpd-radius);
    box-shadow: var(--mpd-shadow);
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    width: 100%;
    box-sizing: border-box;
}

.mpd-widget-card h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--mpd-text);
    border-bottom: 1px solid var(--mpd-bg);
    padding-bottom: 10px;
}

/* ID Card Preview */
.mpd-id-card-preview {
    background: #f7f7f7;
    padding: 10px;
    border-radius: 6px;
    border: 1px dashed #ccc;
    display: flex;
    justify-content: center;
}

.mpd-id-card-face {
    width: 100%;
    max-width: 300px;
    background: linear-gradient(135deg, #fff 0%, #f0f8ff 100%);
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.mpd-id-header {
    background: #003366;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    padding: 8px;
    text-transform: uppercase;
}

.mpd-id-body {
    padding: 15px;
    display: flex;
    align-items: center;
}

.mpd-id-photo {
    width: 60px;
    height: 60px;
    margin-right: 15px;
    border: 2px solid #eee;
    border-radius: 4px;
    overflow: hidden;
}

.mpd-id-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mpd-id-details {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    line-height: 1.3;
}

.mpd-id-details strong {
    font-size: 14px;
    color: #000;
    margin-bottom: 2px;
}

.mpd-id-details span {
    color: #555;
    margin-bottom: 4px;
}

.mpd-id-details small {
    color: #888;
    font-size: 11px;
}

/* Buttons */
.mpd-btn-full {
    display: block;
    width: 100%;
    padding: 8px 0;
    text-align: center;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-size: 14px;
    transition: all 0.2s;
}

.mpd-btn-primary {
    background: var(--mpd-primary);
    color: #fff !important;
}

.mpd-btn-primary:visited,
.mpd-btn-primary:focus,
.mpd-btn-primary:active {
    color: #fff !important;
    text-decoration: none;
}

.mpd-btn-primary:hover {
    background: var(--mpd-primary-dark);
    color: #fff !important;
}

.mpd-btn-danger {
    background: var(--mpd-danger);
    color: #fff;
    border: none;
}

.mpd-btn-danger:hover {
    background: #bb2d3b;
    color: #fff;
}

.mpd-btn-centered-rounded {
    border-radius: 25px;
    padding: 10px 20px;
    text-align: center;
    display: block;
    margin: 0 auto;
    width: fit-content;
    min-width: 200px;
}

.mpd-btn-outline {
    background: transparent;
    border: 1px solid var(--mpd-border);
    color: var(--mpd-text);
}

.mpd-btn-outline:hover {
    background: #f2f2f2;
    color: #333 !important;
}

/* Stats */
.mpd-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.mpd-stat-row:last-child {
    border-bottom: none;
}

.mpd-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    line-height: 1.2;
    border: 1px solid transparent;
    letter-spacing: 0.5px;
}

.mpd-status-active {
    background-color: transparent;
    color: var(--mpd-primary);
    border-color: var(--mpd-primary);
}

.mpd-status-inactive {
    background-color: transparent;
    color: var(--mpd-secondary);
    border-color: var(--mpd-secondary);
}

.mpd-status-error {
    background-color: #fff5f5;
    color: var(--mpd-danger);
    border-color: var(--mpd-danger);
}

/* Embeds */
.mpd-post-embed {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
}

.mpd-post-embed iframe {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16/9;
    display: block;
}

/* Link Card Styles */
.mpd-link-card {
    display: flex;
    align-items: center;
    background: #f0f2f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
    gap: 15px;
}

.mpd-link-card:hover {
    background: #e4e6eb;
    border-color: #ccc;
}

.mpd-link-icon {
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid #eee;
}

.mpd-link-icon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.mpd-link-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mpd-link-domain {
    font-size: 11px;
    color: #65676b;
    font-weight: 600;
    margin-bottom: 2px;
}

.mpd-link-title {
    font-size: 15px;
    color: #050505;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mpd-link-url {
    font-size: 12px;
    color: var(--mpd-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mpd-link-arrow {
    color: #65676b;
    flex-shrink: 0;
}

/* Menu Widget */
.mpd-menu-widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mpd-menu-widget li {
    margin-bottom: 5px;
}

.mpd-menu-widget a {
    display: flex;
    align-items: center;
    padding: 10px;
    color: var(--mpd-text);
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: background 0.2s;
    position: relative;
}

.mpd-menu-widget a:hover, .mpd-menu-widget a.active {
    background-color: #f0f2f5;
    color: var(--mpd-primary);
}

.mpd-menu-widget a i {
    width: 24px;
    text-align: center;
    margin-right: 10px;
    font-size: 18px;
}

/* Notification Badge */
.mpd-notification-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #e74c3c;
    color: white;
    font-size: 12px;
    font-weight: 700;
    border-radius: 10px;
    margin-left: 8px;
    line-height: 1;
}

/* Create Post */
.mpd-create-post-card {
    background: var(--mpd-card-bg);
    border-radius: var(--mpd-radius);
    box-shadow: var(--mpd-shadow);
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid rgba(0,0,0,0.05);
}

.mpd-create-post-header {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
    align-items: flex-start;
}

.mpd-create-post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

#mpd-new-post-content {
    flex-grow: 1;
    border: none;
    background: #f0f2f5;
    border-radius: 20px;
    padding: 12px 15px;
    resize: none;
    min-height: 44px;
    transition: min-height 0.2s, background 0.2s;
    outline: none;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.4;
    overflow: hidden;
}

#mpd-new-post-content:focus {
    min-height: 100px;
    background: #e4e6eb;
}

.mpd-create-post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f0f2f5;
    padding-top: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.mpd-create-post-options {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.mpd-create-post-options select {
    border: none;
    background: #f0f2f5;
    padding: 8px 12px;
    border-radius: 18px;
    font-size: 13px;
    color: var(--mpd-text);
    outline: none;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.mpd-create-post-options select:hover {
    background: #e4e6eb;
}

#mpd-new-post-embed {
    border: 1px solid #ddd !important;
    padding: 8px 12px !important;
    border-radius: 18px !important;
    font-size: 13px !important;
    width: 220px !important;
    background: #fff;
    outline: none;
    transition: border-color 0.2s;
}

#mpd-new-post-embed:focus {
    border-color: var(--mpd-primary) !important;
}

#mpd-submit-post-btn {
    padding: 8px 24px;
    border-radius: 18px;
    font-weight: 600;
    font-size: 14px;
    border: none;
    background: var(--mpd-primary);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

#mpd-submit-post-btn:hover {
    background: var(--mpd-primary-dark);
}

/* Mobile adjustments for Create Post */
@media (max-width: 600px) {
    .mpd-create-post-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .mpd-create-post-options {
        flex-direction: column;
        align-items: stretch;
    }
    
    #mpd-new-post-embed {
        width: 100% !important;
        margin-left: 0 !important;
    }
    
    #mpd-submit-post-btn {
        width: 100%;
    }
}

/* Feed Filters */
.mpd-feed-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 5px;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.mpd-feed-filters::-webkit-scrollbar {
    display: none;
}

.mpd-filter-btn {
    background: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    color: var(--mpd-text-muted);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    font-size: 14px;
}

.mpd-filter-btn:hover {
    background: #e4e6eb;
    color: var(--mpd-text);
}

.mpd-filter-btn.active {
    background: #e7f3ff;
    color: var(--mpd-primary);
}

/* Feed Container Stability */
#mpd-wall-feed {
    min-height: 600px; /* Prevent layout shift when filtering */
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Feed Posts */
.mpd-post-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.mpd-post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
}

.mpd-post-avatar-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e7f3ff;
    color: var(--mpd-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 20px;
}

.mpd-post-header div {
    display: flex;
    flex-direction: row; /* Force row direction */
    align-items: center;
}

.mpd-post-header strong {
    font-size: 15px;
    color: var(--mpd-text);
}

.mpd-post-header span {
    font-size: 12px;
    color: var(--mpd-text-muted);
}

.mpd-post-body {
    font-size: 15px;
    color: var(--mpd-text);
    margin-bottom: 15px;
}

.mpd-post-body p {
    margin-bottom: 10px;
}

.mpd-post-footer {
    border-top: 1px solid var(--mpd-border);
    padding-top: 10px;
    display: flex;
    gap: 10px;
}

.mpd-post-footer button {
    flex: 1;
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: 20px;
    color: var(--mpd-text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mpd-post-footer button:hover {
    background-color: #f0f2f5;
}

/* Login Form Specifics */
.mpd-login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    /* background: var(--mpd-bg); Removed background */
    padding: 20px;
}

.mpd-login-card {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    /* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); Removed shadow */
    width: 100%;
    max-width: 360px;
    text-align: center;
}

.mpd-login-header {
    margin-bottom: 25px;
}

.mpd-login-icon-circle {
    width: 60px;
    height: 60px;
    background: #f0f2f5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    color: var(--mpd-primary);
}

.mpd-login-logo {
    max-width: 80px;
    height: auto;
    margin-bottom: 15px;
}

.mpd-login-header h2 {
    margin: 0 0 8px;
    color: var(--mpd-text);
    font-size: 22px;
    font-weight: 700;
}

.mpd-login-header p {
    margin: 0;
    color: var(--mpd-text-muted);
    font-size: 14px;
}

/* Floating Labels */
.mpd-form-group {
    margin-bottom: 20px;
    text-align: left;
    position: relative; /* Ensure context for absolute positioning */
}

.mpd-input-wrapper {
    position: relative;
    width: 100%;
}

.mpd-floating-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
    height: 50px; /* Fixed height to prevent collapse */
    box-sizing: border-box; /* Include padding in width/height */
}

.mpd-floating-input:focus {
    border-color: var(--mpd-primary);
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.2);
}

.mpd-floating-label {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    padding: 0 4px;
    color: #65676b;
    font-size: 16px;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 1; /* Ensure label is above input background */
    line-height: 1;
}

.mpd-floating-input:focus ~ .mpd-floating-label,
.mpd-floating-input:not(:placeholder-shown) ~ .mpd-floating-label {
    top: 0;
    font-size: 12px;
    color: var(--mpd-primary);
    transform: translateY(-50%); /* Center on the border line */
}

/* Input Icons Support */
.mpd-input-with-icon .mpd-floating-input {
    padding-left: 42px !important;
}

.mpd-input-with-icon .mpd-floating-label {
    left: 42px !important;
}

.mpd-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    display: flex;
    align-items: center;
    pointer-events: none;
    transition: color 0.2s;
    z-index: 2;
}

.mpd-floating-input:focus ~ .mpd-input-icon {
    color: var(--mpd-primary);
}

/* Adjust label when floating */
.mpd-input-with-icon .mpd-floating-input:focus ~ .mpd-floating-label,
.mpd-input-with-icon .mpd-floating-input:not(:placeholder-shown) ~ .mpd-floating-label {
    left: 10px !important; /* Reset left position when floating */
}

/* Actions (Remember & Forgot) */
.mpd-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 14px;
    flex-wrap: wrap; /* Allow wrapping on very small screens */
    gap: 10px;
}

.mpd-checkbox-custom {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--mpd-text);
    user-select: none;
    margin: 0; /* Reset margin */
}

.mpd-checkbox-custom input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    height: 18px;
    width: 18px;
    background-color: #fff;
    border: 1px solid #ced0d4;
    border-radius: 4px;
    margin-right: 8px;
    position: relative;
    flex-shrink: 0; /* Prevent shrinking */
}

.mpd-checkbox-custom:hover input ~ .checkmark {
    background-color: #f0f2f5;
}

.mpd-checkbox-custom input:checked ~ .checkmark {
    background-color: var(--mpd-primary);
    border-color: var(--mpd-primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.mpd-checkbox-custom input:checked ~ .checkmark:after {
    display: block;
}

.mpd-checkbox-custom .checkmark:after {
    left: 6px;
    top: 2px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.mpd-forgot-pass {
    color: var(--mpd-primary);
    text-decoration: none;
    font-weight: 500;
}

.mpd-forgot-pass:hover {
    text-decoration: underline;
}

.mpd-btn-login {
    width: 100%;
    padding: 12px;
    background: var(--mpd-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.mpd-btn-login:hover {
    background: var(--mpd-primary-dark);
}

/* Mobile Specific Adjustments for Cover & Avatar */
@media (max-width: 600px) {
    .mpd-cover-photo {
        height: 140px; /* Reduce height to show more width of the image */
    }
    
    .mpd-avatar-container {
        width: 140px;
        height: 140px;
        margin-top: -70px; /* Pull it up halfway */
    }
    
    .mpd-camera-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

/* --- Comments Section --- */
.mpd-comments-section {
    border-top: 1px solid var(--mpd-border);
    padding-top: 10px;
    margin-top: 10px;
}

.mpd-comments-list {
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mpd-comment {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.mpd-comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.mpd-comment-bubble {
    background: #f0f2f5;
    padding: 8px 12px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    max-width: 100%;
}

.mpd-comment-bubble strong {
    display: block;
    font-size: 13px;
    color: #050505;
    margin-bottom: 2px;
}

.mpd-comment-bubble p {
    margin: 0;
    color: #050505;
}

/* Comment Form */
.mpd-comment-form {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-top: 10px;
}

.mpd-comment-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.mpd-comment-input-wrapper {
    flex-grow: 1;
    position: relative;
    display: flex;
    align-items: center;
    background: #f0f2f5;
    border-radius: 18px;
    padding: 4px 12px;
    transition: background-color 0.2s;
}

.mpd-comment-input-wrapper:focus-within {
    background-color: #e4e6eb;
}

.mpd-comment-input {
    flex-grow: 1;
    width: auto;
    border: none !important;
    background-color: transparent !important;
    padding: 8px 0;
    font-size: 14px;
    resize: none;
    height: 36px; /* Single line height initially */
    outline: none !important;
    font-family: inherit;
    box-shadow: none !important;
    overflow-y: auto;
    /* Hide scrollbar */
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.mpd-comment-input::-webkit-scrollbar {
    display: none;
}

.mpd-comment-input:focus {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
    background-color: transparent !important;
}

.mpd-send-comment-btn {
    background: transparent;
    border: none;
    color: var(--mpd-primary);
    cursor: pointer;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: none; /* Remove transition */
}

.mpd-send-comment-btn:hover {
    color: var(--mpd-primary) !important; /* Keep same color */
    opacity: 1 !important; /* No opacity change */
    background: transparent !important;
}

.mpd-send-comment-btn:disabled {
    color: var(--mpd-text-muted);
    cursor: not-allowed;
}

/* --- Edit Comment Styles --- */
.mpd-edit-comment-wrapper {
    margin-top: 5px;
    min-width: 280px; /* Ensure it's wide enough */
    max-width: 100%;
    box-sizing: border-box;
}

.mpd-edit-comment-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 18px; /* Rounded corners */
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
    background: #fff;
    outline: none;
}

.mpd-edit-comment-input:focus {
    border-color: var(--mpd-primary);
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.1);
}

.mpd-edit-actions-small {
    display: flex;
    gap: 8px;
    margin-top: 5px;
    justify-content: flex-end;
}

.mpd-edit-actions-small button {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    border: none;
    font-weight: 600;
}

.mpd-cancel-edit-btn {
    background: transparent;
    color: var(--mpd-text-muted);
}

.mpd-cancel-edit-btn:hover {
    text-decoration: underline;
}

.mpd-save-edit-btn {
    background: var(--mpd-primary);
    color: #fff;
}

.mpd-save-edit-btn:hover {
    background: var(--mpd-primary-dark);
}

.mpd-view-more-comments {
    background: transparent;
    border: none;
    color: var(--mpd-text-muted);
    font-weight: 600;
    cursor: pointer;
    padding: 5px 0;
    font-size: 14px;
    margin-bottom: 10px;
    display: block;
    width: 100%;
    text-align: left;
}

.mpd-view-more-comments:hover {
    text-decoration: underline;
}

.mpd-comment-actions {
    font-size: 12px;
    color: var(--mpd-text-muted);
    margin-top: 2px;
    margin-left: 12px;
}

.mpd-comment-actions a {
    color: var(--mpd-text-muted);
    text-decoration: none;
    font-weight: 600;
}

.mpd-comment-actions a:hover {
    text-decoration: underline;
}

/* --- Polls Module --- */
.mpd-poll-card {
    border-left: 4px solid var(--mpd-primary);
}
.mpd-poll-desc {
    font-size: 14px;
    color: var(--mpd-text-muted);
    margin-bottom: 15px;
}
.mpd-poll-option {
    transition: background 0.2s;
}
.mpd-poll-option:hover {
    background: #f8f9fa;
}
.mpd-poll-results {
    background: #f8f9fa;
    padding: 15px;
    border-radius: var(--mpd-radius);
}
.mpd-poll-result-row strong {
    font-size: 14px;
}
.mpd-poll-result-row span {
    font-size: 13px;
    color: var(--mpd-text-muted);
}

/* --- Modern Poll Design --- */
.mpd-poll-card {
    border: none !important;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.mpd-poll-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

.mpd-poll-header-styled {
    padding: 20px;
    background: linear-gradient(to right, #f8f9fa, #ffffff);
    border-bottom: 1px solid #eee;
}

.mpd-poll-meta-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.mpd-poll-badge {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}
.mpd-poll-badge.active {
    background-color: #e6f4ea;
    color: #1e7e34;
}
.mpd-poll-badge.expired {
    background-color: #fbeaea;
    color: #dc3545;
}

.mpd-poll-deadline {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
}

.mpd-poll-header-styled h3 {
    margin: 0 0 10px 0;
    font-size: 1.25rem;
    color: #333;
    font-weight: 700;
}

.mpd-poll-desc {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.5;
}

.mpd-poll-body-styled {
    padding: 20px;
}

/* Modern Radio Options */
.mpd-poll-options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.mpd-poll-option-modern {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.mpd-poll-option-modern:hover {
    border-color: var(--mpd-primary);
    background-color: #f8faff;
}

.mpd-poll-option-modern input[type="radio"] {
    display: none; /* Hide default radio */
}

.mpd-poll-radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #adb5bd;
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    transition: all 0.2s ease;
}

.mpd-poll-option-modern input[type="radio"]:checked + .mpd-poll-radio-custom {
    border-color: var(--mpd-primary);
    background-color: var(--mpd-primary);
}

.mpd-poll-radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 8px;
    height: 8px;
    background-color: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.mpd-poll-option-modern input[type="radio"]:checked + .mpd-poll-radio-custom::after {
    transform: translate(-50%, -50%) scale(1);
}

.mpd-poll-option-text {
    font-weight: 500;
    color: #333;
}

.mpd-poll-option-modern input[type="radio"]:checked ~ .mpd-poll-option-text {
    color: var(--mpd-primary);
    font-weight: 600;
}

.mpd-poll-option-modern:has(input:checked) {
    border-color: var(--mpd-primary);
    background-color: #f0f7ff;
}

.mpd-btn-vote {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Results View */
.mpd-poll-result-row {
    margin-bottom: 15px;
}

.mpd-poll-result-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.mpd-poll-progress-bar {
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.mpd-poll-progress-fill {
    height: 100%;
    background-color: var(--mpd-primary);
    border-radius: 4px;
    transition: width 1s ease-in-out;
}

.mpd-poll-vote-count {
    font-size: 0.8rem;
    color: #888;
    text-align: right;
}

.mpd-poll-hash-box {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px dashed #ced4da;
    border-radius: 6px;
    text-align: center;
}

.mpd-hash-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #495057;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.mpd-hash-code {
    display: block;
    font-family: monospace;
    background: #fff;
    padding: 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    color: var(--mpd-primary);
    word-break: break-all;
    font-size: 0.9rem;
    margin: 5px 0;
}

.mpd-hash-info {
    font-size: 0.8rem;
    color: #6c757d;
    margin: 0;
}

/* Verifier Modal Styles */
.mpd-verifier-container {
    padding: 20px;
}
.mpd-verifier-container h3 {
    margin-top: 0;
    color: var(--mpd-primary);
}
.mpd-verifier-result {
    margin-top: 20px;
    padding: 15px;
    border-radius: 6px;
}
.mpd-verifier-result.success {
    background-color: #d1e7dd;
    border: 1px solid #badbcc;
    color: #0f5132;
}
.mpd-verifier-result.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #842029;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .mpd-poll-card {
        margin-bottom: 20px;
    }
    
    .mpd-poll-header-styled {
        padding: 15px;
    }
    
    .mpd-poll-meta-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .mpd-poll-deadline {
        font-size: 0.75rem;
    }
    
    .mpd-poll-body-styled {
        padding: 15px;
    }
    
    .mpd-poll-option-modern {
        padding: 10px;
    }
    
    /* Modal Mobile */
    #mpd-verifier-modal > div {
        width: 95% !important;
        margin: 20px auto !important;
        max-height: 85vh !important;
    }
    
    .mpd-verifier-container {
        padding: 15px;
    }
    
    .mpd-verifier-container h3 {
        font-size: 1.2rem;
    }
    
    .mpd-verifier-result {
        font-size: 0.9rem;
    }
    
    .mpd-hash-code {
        font-size: 0.75rem;
        overflow-x: auto;
    }
}

/* --- Improved Verification & Toggle Styles --- */
.mpd-verifier-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.mpd-verifier-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
}

.mpd-verifier-date {
    font-size: 0.8rem;
    color: #6c757d;
}

.mpd-verifier-choice {
    font-size: 1rem;
    margin-bottom: 15px;
    color: #212529;
}

.mpd-btn-toggle-hash {
    background: none;
    border: none;
    color: var(--mpd-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.mpd-btn-toggle-hash:hover {
    text-decoration: underline;
}

.mpd-verifier-hashes {
    margin-top: 10px;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.8rem;
}

.mpd-hash-row {
    margin-bottom: 5px;
    word-break: break-all;
}

.mpd-hash-row code {
    display: block;
    background: #fff;
    border: 1px solid #dee2e6;
    padding: 4px;
    border-radius: 3px;
    margin-top: 2px;
    color: #d63384;
}

/* Dashboard Hash Box Update */
.mpd-poll-hash-box {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 10px;
    text-align: left;
}

.mpd-poll-hash-box .mpd-btn-toggle-hash {
    width: 100%;
    justify-content: center;
}

/* Mobile Adjustments for Verifier */
@media (max-width: 768px) {
    .mpd-verifier-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .mpd-verifier-date {
        margin-top: 4px;
    }
}

/* --- Refined UI & Modal Styles --- */

/* Modal Content Wrapper */
.mpd-modal-content {
    background: #fff;
    width: 90%;
    max-width: 600px;
    margin: 0 auto;
    border-radius: 16px; /* More rounded */
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    padding: 0; /* Let inner container handle padding */
}

/* Animations */
@keyframes mpd-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Close Button */
.mpd-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f0f2f5;
    border-radius: 50%;
    font-size: 24px;
    line-height: 32px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}
.mpd-modal-close:hover {
    background: #e4e6eb;
    color: #000;
}

/* Rounded Cards */
.mpd-poll-card {
    border-radius: 16px !important;
    overflow: hidden;
}

/* Hash Toggle Button - Centered & Styled */
.mpd-poll-hash-box .mpd-btn-toggle-hash,
.mpd-verifier-item .mpd-btn-toggle-hash {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    background-color: #f0f7ff;
    color: var(--mpd-primary);
    border-radius: 8px;
    font-weight: 600;
    margin-top: 10px;
    transition: background 0.2s;
}
.mpd-poll-hash-box .mpd-btn-toggle-hash:hover,
.mpd-verifier-item .mpd-btn-toggle-hash:hover {
    background-color: #e0efff;
    text-decoration: none;
}

/* Responsive Hash Code */
.mpd-hash-code, .mpd-hash-row code {
    white-space: pre-wrap;       /* CSS3 */   
    white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
    white-space: -pre-wrap;      /* Opera 4-6 */
    white-space: -o-pre-wrap;    /* Opera 7 */
    word-wrap: break-word;       /* Internet Explorer 5.5+ */
    overflow-wrap: anywhere;     /* Standard */
    font-size: 0.8rem;
    background: #f8f9fa;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    color: #d63384;
    display: block;
    max-width: 100%;
}

/* Mobile Specific Polish */
@media (max-width: 768px) {
    .mpd-modal-content {
        width: 98%; /* Wider modal on mobile */
        border-radius: 12px;
    }
    
    .mpd-verifier-container {
        padding: 20px 10px; /* Reduced padding */
    }
    
    .mpd-poll-header-styled h3 {
        font-size: 1.1rem;
    }
    
    .mpd-btn-vote {
        border-radius: 8px;
    }
}

/* --- FINAL FIXES: Modal & Hash Wrapping --- */

/* Ensure Modal Background is Solid White & Rounded */
.mpd-modal-content {
    background-color: #ffffff !important;
    border-radius: 24px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    border: 1px solid rgba(255,255,255,0.1);
    overflow: hidden; /* Clip children to rounded corners */
}

/* Fix Close Button Icon Alignment */
.mpd-modal-close {
    background: #f1f5f9 !important;
    color: #64748b !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    top: 20px !important;
    right: 20px !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.mpd-modal-close:hover {
    background: #e2e8f0 !important;
    color: #ef4444 !important;
}

/* FORCE Hash Wrapping on Mobile */
.mpd-hash-code, 
.mpd-hash-row code {
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    overflow-wrap: anywhere !important;
    word-break: break-all !important; /* Aggressive break for long hashes */
    display: block !important;
    max-width: 100% !important;
    font-family: 'Courier New', Courier, monospace !important;
    font-size: 0.75rem !important;
    line-height: 1.4 !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    color: #d63384 !important;
}

/* Mobile Modal Adjustments */
@media (max-width: 768px) {
    .mpd-modal-content {
        width: 92% !important;
        margin: 0 auto !important;
        max-height: 80vh !important;
        border-radius: 20px !important;
    }
    
    .mpd-verifier-container {
        padding: 25px 20px !important;
    }
    
    /* Ensure input fields don't overflow */
    .mpd-verifier-form input {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* --- Modern Polls Section --- */

.mpd-section-header {
    background: #fff;
    padding: 20px;
    border-radius: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 15px;
}

.mpd-header-icon {
    width: 50px;
    height: 50px;
    background: #e7f3ff;
    color: #1877f2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.mpd-header-text h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #050505;
}

.mpd-header-text p {
    margin: 4px 0 0;
    font-size: 14px;
    color: #65676b;
}

.mpd-action-bar {
    margin-bottom: 25px;
}

.mpd-btn-verify-block {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    background: #fff;
    border: 2px dashed #1877f2;
    color: #1877f2;
    padding: 15px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.mpd-btn-verify-block:hover {
    background: #f0f8ff;
    transform: translateY(-2px);
}

/* --- Modern Poll Card --- */

.mpd-poll-card-modern {
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-bottom: 30px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.03);
}

.mpd-poll-header-modern {
    padding: 20px 25px;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.mpd-poll-meta h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 700;
    color: #050505;
    line-height: 1.3;
}

.mpd-poll-date {
    font-size: 13px;
    color: #65676b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mpd-poll-status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mpd-poll-status-badge.active {
    background: #e7f3ff;
    color: #1877f2;
}

.mpd-poll-status-badge.closed {
    background: #f0f2f5;
    color: #65676b;
}

.mpd-poll-body-modern {
    padding: 25px;
}

/* --- Voting Form --- */

.mpd-poll-options-grid {
    display: grid;
    gap: 12px;
    margin-bottom: 25px;
}

.mpd-poll-option-card {
    display: block;
    cursor: pointer;
    position: relative;
}

.mpd-poll-option-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.mpd-option-content {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: #f7f8fa;
    border: 2px solid transparent;
    border-radius: 16px;
    transition: all 0.2s ease;
}

.mpd-radio-circle {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #bcc0c4;
    margin-right: 15px;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s;
}

.mpd-radio-circle::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    background: #1877f2;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.2s;
}

.mpd-option-label {
    font-size: 15px;
    font-weight: 500;
    color: #050505;
}

/* Checked State */
.mpd-poll-option-card input:checked + .mpd-option-content {
    background: #e7f3ff;
    border-color: #1877f2;
}

.mpd-poll-option-card input:checked + .mpd-option-content .mpd-radio-circle {
    border-color: #1877f2;
}

.mpd-poll-option-card input:checked + .mpd-option-content .mpd-radio-circle::after {
    transform: translate(-50%, -50%) scale(1);
}

.mpd-btn-vote-modern {
    width: 100%;
    padding: 16px;
    background: #1877f2;
    color: #fff;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.mpd-btn-vote-modern:hover {
    background: #166fe5;
}

/* --- Results View --- */

.mpd-result-item {
    margin-bottom: 20px;
}

.mpd-result-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.mpd-result-label {
    font-weight: 600;
    color: #050505;
}

.mpd-result-percent {
    font-weight: 700;
    color: #1877f2;
}

.mpd-progress-track {
    height: 12px;
    background: #f0f2f5;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 6px;
}

.mpd-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #1877f2, #3b8ff5);
    border-radius: 10px;
    transition: width 1s ease-out;
}

.mpd-result-count {
    font-size: 12px;
    color: #65676b;
    text-align: right;
}

/* --- Hash Section --- */

.mpd-hash-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #f0f2f5;
}

.mpd-btn-hash-toggle {
    background: none;
    border: none;
    color: #65676b;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
}

.mpd-btn-hash-toggle:hover {
    color: #1877f2;
}

.mpd-hash-details {
    margin-top: 15px;
    background: #f7f8fa;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #e4e6eb;
}

.mpd-hash-title {
    font-size: 12px;
    text-transform: uppercase;
    color: #65676b;
    font-weight: 700;
    margin-bottom: 8px;
}

.mpd-hash-code-block {
    display: block;
    font-family: monospace;
    background: #fff;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
    word-break: break-all !important;
    white-space: pre-wrap;
    font-size: 12px;
    color: #333;
    margin-bottom: 10px;
}

.mpd-hash-explainer {
    font-size: 12px;
    color: #65676b;
    margin: 0;
    line-height: 1.4;
}

/* Mobile Fixes */
@media (max-width: 600px) {
    .mpd-poll-header-modern {
        flex-direction: column;
        gap: 10px;
    }
    
    .mpd-poll-status-badge {
        align-self: flex-start;
    }
}

/* --- Fixes for Poll Header Structure --- */

.mpd-poll-content-wrapper {
    /* Wrapper if needed, otherwise just block */
}

.mpd-poll-header-modern {
    padding: 20px 25px;
    border-bottom: 1px solid #f0f2f5;
    display: block; /* Changed from flex to block to stack badges, title, desc */
}

.mpd-poll-badges {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.mpd-badge-pill {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mpd-badge-pill.active {
    background: #e7f3ff;
    color: #1877f2;
}

.mpd-badge-pill.expired {
    background: #f0f2f5;
    color: #65676b;
}

.mpd-badge-pill.time {
    background: #fff;
    border: 1px solid #e4e6eb;
    color: #65676b;
}

.mpd-poll-header-modern h3 {
    margin: 0 0 10px 0;
    font-size: 20px;
    font-weight: 700;
    color: #050505;
    line-height: 1.3;
}

.mpd-poll-desc-modern {
    font-size: 15px;
    color: #65676b;
    line-height: 1.5;
}

.mpd-poll-desc-modern p {
    margin: 0 0 10px 0;
}

.mpd-poll-desc-modern p:last-child {
    margin: 0;
}

.mpd-poll-status-bar {
    height: 4px;
    width: 100%;
}

.mpd-poll-status-bar.active {
    background: #1877f2;
}

.mpd-poll-status-bar.expired {
    background: #65676b;
}

/* --- EMERGENCY FIXES FOR MOBILE & LAYOUT --- */

/* Fix Badges on Mobile */
@media (max-width: 600px) {
    .mpd-badge-pill {
        font-size: 9px !important;
        padding: 3px 6px !important;
        letter-spacing: 0 !important;
        white-space: nowrap;
    }
    .mpd-badge-pill svg {
        width: 9px !important;
        height: 9px !important;
        margin-right: 2px !important;
    }
    .mpd-poll-badges {
        gap: 4px !important;
        flex-wrap: wrap;
    }
}

/* 1. Ensure the main wrapper doesn't overflow */
.mpd-dashboard-wrapper {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* 2. Fix Poll Card Container */
.mpd-poll-card-modern {
    background: #fff !important;
    border-radius: 24px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
    margin-bottom: 30px !important;
    overflow: hidden !important;
    border: 1px solid rgba(0,0,0,0.05) !important;
    position: relative;
    width: 100%;
}

/* 3. Fix Header Layout on Mobile */
.mpd-section-header {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.mpd-header-icon {
    margin-bottom: 10px;
}

/* 4. Fix Hash Overflow - CRITICAL */
.mpd-hash-code-block {
    white-space: pre-wrap !important;
    word-break: break-all !important;
    overflow-wrap: anywhere !important;
    font-size: 11px !important;
    max-width: 100% !important;
    display: block;
}

/* 5. Fix Button Widths */
.mpd-btn-vote-modern, 
.mpd-btn-verify-block {
    width: 100%;
    box-sizing: border-box;
}

/* 6. Fix Radio Button Layout */
.mpd-poll-option-card {
    width: 100%;
}

.mpd-option-content {
    width: 100%;
    box-sizing: border-box;
}

/* 7. Ensure Text Doesn't Overflow */
.mpd-poll-header-modern h3 {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* 8. Fix Modal Z-Index and Visibility */
#mpd-verifier-modal {
    z-index: 999999 !important;
}

.mpd-modal-content {
    background: #fff !important;
    border-radius: 24px !important;
    padding: 20px !important;
    max-width: 90% !important;
    width: 500px !important;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2) !important;
}

/* 9. Fix Action Bar Spacing */
.mpd-action-bar {
    margin: 20px 0;
    width: 100%;
}

/* 10. Specific Fix for "Vezi Dovada" Button */
.mpd-btn-hash-toggle {
    width: 100%;
    justify-content: center;
    padding: 12px;
    background: #f0f2f5;
    border-radius: 8px;
    margin-bottom: 10px;
}


/* --- FINAL OVERFLOW FIX --- */
.mpd-hash-container-scroll {
    width: 100%;
    overflow-x: auto;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
}

.mpd-hash-code-block {
    white-space: pre-wrap !important; /* Allow wrapping */
    word-break: break-all !important; /* Force break on long words */
    overflow-wrap: anywhere !important; /* Modern break */
    font-size: 11px !important;
    color: #333;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block;
}

/* --- STICKY HEADER & LAYOUT FIXES --- */

/* Sticky Header Container */
.mpd-sticky-header-container {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #f0f2f5; /* Hardcoded to ensure visibility */
    padding-top: 20px;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

/* Ensure the header and action bar are stacked correctly */
.mpd-sticky-header-container .mpd-section-header {
    margin-bottom: 15px;
}

.mpd-sticky-header-container .mpd-action-bar {
    margin-bottom: 0;
}

/* Scroll Area for Polls */
.mpd-polls-scroll-area {
    padding-top: 10px;
}

/* Vezi Dovada Button Styling */
.mpd-btn-hash-toggle {
    width: 100%;
    justify-content: center;
    padding: 12px;
    background: #f0f2f5;
    border-radius: 24px !important; /* Rounded */
    margin-bottom: 10px;
    text-align: center;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #1877f2;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.mpd-btn-hash-toggle:hover {
    background: #e7f3ff;
    border-color: #1877f2;
}

/* Fix Desktop Loading Issue (Potential CSS Conflict) */
/* Ensure no infinite loops or massive repaints */
.mpd-poll-card-modern {
    /* contain: content; REMOVED to prevent rendering issues */
    background: #fff;
    position: relative;
}

/* Mobile Specific Adjustments for Sticky Header */
@media (max-width: 768px) {
    .mpd-sticky-header-container {
        padding-left: 0;
        padding-right: 0;
        margin-left: -10px; /* Slight negative margin to align with edge if needed */
        margin-right: -10px;
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* --- MODERN VERIFIER MODAL STYLES --- */

.mpd-verifier-container-modern {
    background: #fff;
    padding: 10px;
    width: 100%;
    box-sizing: border-box;
}

.mpd-verifier-header-modern {
    text-align: center;
    margin-bottom: 25px;
}

.mpd-verifier-icon {
    width: 60px;
    height: 60px;
    background: #e7f3ff;
    color: #1877f2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 15px auto;
}

.mpd-verifier-header-modern h3 {
    margin: 0 0 8px 0;
    font-size: 22px;
    font-weight: 700;
    color: #050505;
}

.mpd-verifier-header-modern p {
    margin: 0;
    font-size: 14px;
    color: #65676b;
    line-height: 1.4;
}

.mpd-verifier-form-modern {
    margin-bottom: 20px;
}

.mpd-input-group-modern {
    position: relative;
    margin-bottom: 15px;
}

.mpd-input-group-modern i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #65676b;
    font-size: 18px;
}

.mpd-input-group-modern input {
    width: 100%;
    padding: 14px 14px 14px 45px; /* Space for icon */
    border: 1px solid #ced0d4;
    border-radius: 12px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.mpd-input-group-modern input:focus {
    border-color: #1877f2;
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.2);
}

.mpd-btn-verify-modern {
    width: 100%;
    padding: 14px;
    background: #1877f2;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mpd-btn-verify-modern:hover {
    background: #166fe5;
}

.mpd-btn-verify-modern:disabled {
    background: #b0c2db;
    cursor: not-allowed;
}

/* Results Styling - Unified */
.mpd-verifier-result.success {
    background: transparent;
    border: none;
    border-top: 1px solid #e4e6eb;
    border-radius: 0;
    padding: 20px 0 0 0;
    margin-top: 20px;
}

.mpd-verifier-result.success h4 {
    font-size: 16px;
    color: #050505;
    margin-bottom: 15px;
    font-weight: 700;
}

.mpd-verifier-item {
    background: #f7f8fa;
    border: none;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
}

.mpd-verifier-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

.mpd-verifier-date {
    font-size: 12px;
    color: #65676b;
}

.mpd-verifier-choice {
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: 600;
    color: #050505;
}

.mpd-verifier-hashes {
    background: #fff;
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
    font-size: 11px;
    border: 1px solid #e4e6eb;
}

.mpd-hash-row {
    margin-bottom: 5px;
    word-break: break-all;
}

.mpd-hash-row:last-child {
    margin-bottom: 0;
}

/* Close Button Fix */
.mpd-modal-close {
    z-index: 10000 !important;
    background: #f0f2f5 !important;
    color: #65676b !important;
    width: 36px !important;
    height: 36px !important;
    top: 15px !important;
    right: 15px !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.mpd-modal-close:hover {
    background: #e4e6eb !important;
    color: #000 !important;
}

.mpd-verifier-result.error {
    background: #fef2f2;
    color: #dc2626;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    border: 1px solid #fecaca;
}

/* Custom Scrollbar for Verifier */
.mpd-verifier-scroll-container::-webkit-scrollbar {
    width: 8px;
}
.mpd-verifier-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1; 
    border-radius: 4px;
}
.mpd-verifier-scroll-container::-webkit-scrollbar-thumb {
    background: #ccc; 
    border-radius: 4px;
}
.mpd-verifier-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #aaa; 
}

/* Modern ID Card Styles */
.mpd-id-card-modern {
    background: linear-gradient(135deg, #0052cc 0%, #003380 100%);
    border-radius: 12px;
    padding: 15px;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 51, 128, 0.3);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mpd-id-card-modern::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    pointer-events: none;
}

.mpd-card-header-row {
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 8px;
}

.mpd-card-title {
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.mpd-card-content-row {
    margin-bottom: 10px;
}

.mpd-card-photo-wrapper {
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.mpd-card-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mpd-card-name {
    font-size: 15px !important;
    margin-bottom: 2px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.mpd-card-role {
    color: rgba(255, 255, 255, 0.9);
}

.mpd-card-branch {
    color: rgba(255, 255, 255, 0.8);
}

.mpd-card-id {
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255,255,255,0.2);
}

.mpd-card-qr {
    background: white;
    padding: 3px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.mpd-card-footer-row {
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mpd-card-status.active {
    background: #2ecc71 !important;
    color: white;
    box-shadow: 0 2px 4px rgba(46, 204, 113, 0.3);
}

/* Mobile Fix for Edit Comment */
@media (max-width: 480px) {
    .mpd-edit-comment-wrapper {
        min-width: auto;
    }
}
