/* Full-screen panel (desktop + mobile) */
.sm-panel {
    position: fixed;
    top: 0;
    left: 0;               /* cover from left */
    width: 100%;           /* full width */
    height: 100%;          /* full height */
    background: #ffffff;
    box-shadow: none;      /* no side shadow for full screen */
    transform: none;
    transition: transform .25s ease, opacity .25s ease;
    z-index: 99999;        /* above everything */
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
    line-height: 1.5;      /* Better readability for all text */
    word-break: break-word; /* Handle long words and Bengali text */
}

/* When open — visible and interactive */
.sm-panel.sm-open {
    visibility: visible;
    opacity: 1;
    right: 0;
    left: 0;
}

/* Make inner scroll nicely separated */
.sm-panel-inner {
    max-width: 1100px;     /* content width, centered */
    margin: 24px auto;
    padding: 24px;
    box-sizing: border-box;
}

/* Close button: keep it visible on top-left */
.sm-panel-close {
    position: fixed;
    left: 16px;
    top: 16px;
    z-index: 100000;
    background:#0073aa;
    color:#fff;
    border-radius:4px;
    padding:6px 10px;
    font-size:16px;
    border: none;
}

/* Overlay: ensure it sits under the panel but above page */
.sm-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}
.sm-panel-overlay.sm-open { 
    opacity: 1; 
    visibility: visible; 
}

/* Prevent body scroll when panel open */
body.sm-panel-no-scroll { 
    overflow: hidden; 
}

/* Responsive tweaks: keep content comfortable on small screens */
@media (max-width: 768px) {
    .sm-panel-inner { 
        padding: 18px; 
        margin: 0; 
        width: 100%; 
        box-shadow: none; 
    }
    .sm-panel-close { 
        left: 8px; 
        top: 8px; 
        font-size:18px; 
    }
}

/* Dashboard styles */
.sm-main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.sm-dashboard h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
}

.sm-projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

/* ============================================
   COMPACT MOBILE-FIRST PROJECT CARDS
   ============================================ */
.sm-project-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s ease;
}

.sm-project-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* Compact card header */
.sm-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    gap: 12px;
}

.sm-card-title {
    flex: 1;
    min-width: 0;
}

.sm-card-title h4 {
    margin: 0 0 4px 0;
    color: #0073aa;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sm-card-meta {
    color: #666;
    font-size: 13px;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Badge counts */
.sm-card-badges {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
    flex-shrink: 0;
}

.sm-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.sm-badge-assignments {
    background: #e7f5ff;
    color: #0073aa;
}

.sm-badge-tasks {
    background: #fff3cd;
    color: #856404;
}

.sm-badge-comments {
    background: #d1e7dd;
    color: #0f5132;
}

.sm-badge-label {
    margin-left: 2px;
    font-weight: 400;
}

/* Icon action buttons */
.sm-card-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 10px 16px;
    gap: 8px;
    position: relative;
}

.sm-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #444;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sm-icon-btn:hover {
    background: #f5f5f5;
    border-color: #0073aa;
    color: #0073aa;
}

.sm-icon-btn:active {
    transform: scale(0.95);
}

.sm-icon-btn svg {
    width: 20px;
    height: 20px;
}

/* Overflow menu */
.sm-overflow-menu {
    position: absolute;
    top: 54px;
    right: 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 180px;
    padding: 6px 0;
}

.sm-overflow-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    color: #333;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.sm-overflow-item:hover {
    background: #f5f5f5;
}

.sm-overflow-item.sm-delete-task {
    color: #dc3232;
}

.sm-overflow-item.sm-delete-task:hover {
    background: #fff0f0;
}

/* Assignments container (accordion) */
.sm-assignments-container {
    padding: 0;
    border-top: 1px solid #f0f0f0;
}

.sm-assignments-container.expanded {
    display: block !important;
}

/* Expanded card state */
.sm-project-card.expanded {
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

/* ============================================
   COMPACT ASSIGNMENT ROWS (ACCORDION)
   ============================================ */

.sm-assignments-list-compact {
    padding: 0;
}

.sm-assignment-row-compact {
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s ease;
}

.sm-assignment-row-compact:last-child {
    border-bottom: none;
}

.sm-assignment-row-compact:hover {
    background: #f9f9f9;
}

.sm-assignment-content {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    gap: 12px;
}

/* Chevron button */
.sm-chevron-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.sm-chevron-btn:hover {
    background: #e9e9e9;
}

.sm-chevron-icon {
    transition: transform 0.2s ease;
    color: #666;
}

.sm-chevron-icon.rotated {
    transform: rotate(90deg);
}

/* Assignment info */
.sm-assignment-info {
    flex: 1;
    min-width: 0;
}

.sm-assignment-name {
    font-weight: 600;
    font-size: 15px;
    color: #333;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.5;
    word-break: break-word;
}

.sm-assignment-meta-line {
    font-size: 13px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.5;
}

/* Assignment badges */
.sm-assignment-badges {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.sm-mini-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    background: #e7f5ff;
    color: #0073aa;
    white-space: nowrap;
}

.sm-mini-badge-comments {
    background: #d1e7dd;
    color: #0f5132;
}

/* Unread message badge - WhatsApp style (red) */
.sm-mini-badge-unread {
    background: #dc3545;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

/* Unread badge on project cards */
.sm-badge-unread {
    background: #dc3545 !important;
    color: #fff !important;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

/* Assignment actions */
.sm-assignment-actions-compact {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
    position: relative;
}

.sm-icon-btn-small {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #444;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    pointer-events: auto;
    z-index: 10;
}

.sm-icon-btn-small:hover {
    background: #f5f5f5;
    border-color: #0073aa;
    color: #0073aa;
}

/* Task message button in compact view */
.sm-task-actions-compact .task-message-btn {
    cursor: pointer;
    pointer-events: auto;
}

.sm-icon-btn-small svg {
    width: 16px;
    height: 16px;
    pointer-events: none;
}

/* Prevent spans inside icon buttons from blocking clicks */
.sm-icon-btn-small .sm-comment-count,
.sm-icon-btn-small .sm-attachment-count {
    pointer-events: none;
}

/* View Shared button (green) */
.sm-icon-btn-small.sm-view-shared {
    border-color: #00a32a;
    color: #00a32a;
}

.sm-icon-btn-small.sm-view-shared:hover {
    background: #e7f7ed;
}

/* Shared count badge on button */
.sm-shared-count,
.sm-comment-count,
.sm-attachment-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #dc3545;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 8px;
    line-height: 1;
    min-width: 14px;
    text-align: center;
}

/* Unread badge styling - more prominent */
.sm-unread-badge {
    background: #dc3545 !important;
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    50% {
        box-shadow: 0 0 0 3px rgba(220, 53, 69, 0);
    }
}

/* Overflow menus for assignments */
.sm-overflow-menu-assign {
    position: absolute;
    top: 40px;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 180px;
    padding: 6px 0;
}

/* ============================================
   COMPACT TASK ROWS (NESTED)
   ============================================ */

.sm-tasks-container-compact {
    background: #fafafa;
    border-top: 1px solid #e9e9e9;
}

.sm-tasks-list-compact {
    padding: 0;
}

.sm-task-row-compact {
    display: flex;
    align-items: center;
    padding: 10px 16px 10px 48px;
    gap: 10px;
    border-bottom: 1px solid #e9e9e9;
    transition: background 0.15s ease;
}

.sm-task-row-compact:last-child {
    border-bottom: none;
}

.sm-task-row-compact:hover {
    background: #f5f5f5;
}

/* Task thumbnail */
.sm-task-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
    flex-shrink: 0;
}

/* Task info */
.sm-task-info-compact {
    flex: 1;
    min-width: 0;
}

.sm-task-name {
    font-weight: 600;
    font-size: 13px;
    color: #333;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sm-task-remarks-compact {
    font-size: 11px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Task badges */
.sm-task-badges-compact {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* Task actions */
.sm-task-actions-compact {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

/* Overflow menus for tasks */
.sm-overflow-menu-task {
    position: absolute;
    top: 40px;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 160px;
    padding: 6px 0;
}

/* No assignments/tasks messages */
.no-assignments,
.no-tasks {
    padding: 20px;
    text-align: center;
    color: #999;
    font-style: italic;
    font-size: 13px;
}

/* ============================================
   OPTIMISTIC UI & PENDING STATES
   ============================================ */

/* Pending comment */
.sm-task-comment.sm-pending {
    opacity: 0.7;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 0.9; }
}

/* Failed comment */
.sm-task-comment.sm-failed {
    border-left: 3px solid #dc3545;
    background: #fff5f5;
}

/* Pending/error icons */
.sm-pending-icon,
.sm-error-icon {
    margin-left: 6px;
    font-size: 14px;
    vertical-align: middle;
}

.sm-error-icon {
    color: #dc3545;
}

/* Upload spinner (already inline, but add global styles) */
.sm-upload-spinner {
    user-select: none;
    pointer-events: none;
}

/* Lazy loading images - placeholder background */
.lazy-img {
    background: #f0f0f0;
    min-width: 120px;
    min-height: 90px;
}

.lazy-img[src] {
    background: none;
}

/* Assignment list inside project cards */
.sm-project-card .sm-assignments-list {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #ddd;
}
.sm-project-card .sm-assignment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    margin-bottom: 8px;
    border: 1px solid #e6e6e6;
    border-radius: 4px;
    background: #fff;
    font-size: 13px;
}
.sm-project-card .sm-assignment-left {
    flex: 1;
}
.sm-project-card .sm-assignment-left strong {
    display: block;
    margin-bottom: 2px;
}
.sm-project-card .sm-assignment-meta {
    color: #666;
    font-size: 12px;
}
.sm-project-card .sm-assignment-remarks {
    color: #666;
    font-size: 11px;
    margin-top: 3px;
    font-style: italic;
}
.sm-project-card .sm-assignment-actions {
    display: flex;
    gap: 6px;
}
.sm-project-card .sm-assignment-actions button {
    padding: 4px 8px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    background: #0073aa;
    color: #fff;
}
.sm-project-card .sm-assignment-actions button.delete-assign {
    background: #dc3232;
}

.sm-project-card h4 {
    margin-top: 0;
    color: #0073aa;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.sm-project-card p {
    margin: 8px 0;
    font-size: 14px;
}

.sm-actions {
    text-align: center;
    margin: 20px 0;
}

.sm-actions a {
    display: inline-block;
    padding: 12px 24px;
    background-color: #0073aa;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: background-color 0.3s;
}

.sm-actions a:hover {
    background-color: #005a87;
}

/* Responsive: mobile-first adjustments */
@media (max-width: 768px) {
    .sm-projects-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .sm-main-container {
        padding: 12px;
    }
    
    .sm-card-header {
        padding: 12px 14px;
    }
    
    .sm-card-title h4 {
        font-size: 15px;
    }
    
    .sm-card-badges {
        gap: 3px;
    }
    
    .sm-badge {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .sm-badge-label {
        display: none; /* Hide text labels on very small screens */
    }
    
    .sm-card-actions {
        padding: 8px 14px;
    }
    
    .sm-icon-btn {
        width: 42px;
        height: 42px;
    }
    
    /* Accordion mobile adjustments */
    .sm-assignment-content {
        padding: 12px 14px;
        gap: 10px;
    }
    
    .sm-assignment-name {
        font-size: 14px;
        line-height: 1.5;
    }
    
    .sm-assignment-meta-line {
        font-size: 12px;
        line-height: 1.5;
    }
    
    .sm-assignment-actions-compact {
        gap: 4px;
    }
    
    .sm-icon-btn-small {
        width: 40px;
        height: 40px;
    }
    
    .sm-task-row-compact {
        padding: 8px 12px 8px 42px;
        gap: 8px;
    }
    
    .sm-task-thumb {
        width: 36px;
        height: 36px;
    }
    
    .sm-task-name {
        font-size: 12px;
    }
    
    .sm-task-remarks-compact {
        font-size: 10px;
    }
}

/* FULLSCREEN PROJECT VIEWER (REPLACES inline small box) */
.sm-project-viewer {
  position: fixed;
  inset: 0;
  background: #f7f7f7; /* Light gray background for page */
  z-index: 100000; /* should be above panel */
  display: none;
}
.sm-project-viewer.sm-open {
  display: block;
}
.sm-project-viewer-inner {
  background: #ffffff; /* White background for card */
  width: 100%;
  max-width: 1100px;
  height: 100%;
  box-sizing: border-box;
  padding: 28px;
  overflow-y: auto;
  position: relative;
  margin: 0 auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1); /* Soft card shadow */
}
.sm-project-view-close {
  position: fixed;
  left: 16px;
  top: 16px;
  z-index: 100001;
  background:#0073aa;
  color:#fff;
  border:none;
  padding:8px 14px;
  border-radius:4px;
  cursor:pointer;
  font-size: 14px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* SECOND PANEL — HALF SCREEN */
.sm-subpanel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 100002; /* above viewer */
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease;
}
.sm-subpanel-overlay.sm-open {
    opacity: 1;
    visibility: visible;
}

.sm-subpanel {
    position: fixed;
    top: 0;
    right: 0;               /* anchored to right */
    width: 40%;
    height: 100%;
    background: #fff;
    z-index: 100003; /* above viewer and overlay */
    transform: translateX(100%); /* hidden off-canvas by shifting right */
    transition: transform .25s ease;
    overflow-y: auto;
    padding: 20px;
    box-shadow: -4px 0 12px rgba(0,0,0,0.2);
}
.sm-subpanel.sm-open {
    transform: translateX(0); /* slide in */
}

.sm-subpanel-close {
    position: absolute;
    left: 12px;
    top: 12px;
    background: transparent;
    border: none;
    font-size: 28px;
    cursor: pointer;
}

/* Project assignments container */
#sm-project-assignments {
    margin-top: 10px;
    padding: 12px;
}

/* Header - Flex container with Close + Add New Assignment buttons */
.sm-project-header {
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  border-bottom:1px solid #eee;
  padding-bottom:16px;
  padding-top: 60px; /* Space for fixed close button */
  margin-bottom:20px;
}
.sm-project-title {
  flex: 1;
  min-width: 0;
}
.sm-project-title h2 { 
  margin:0 0 12px 0; 
  color:#0073aa; 
  font-size:22px; 
  line-height: 1.4;
  word-break: break-word;
}
.sm-project-meta { 
  display:flex; 
  gap:12px; 
  flex-wrap:wrap; 
  margin-top: 8px;
}
.meta-item { 
  font-size:14px; 
  color:#444; 
  line-height: 1.5;
}

/* Two-column layout - stacks on mobile */
.sm-project-body { 
  display:flex; 
  gap:24px; 
}
.sm-project-left { 
  flex:1 1 40%; 
  line-height: 1.5;
}
.sm-project-right { 
  flex:1 1 60%; 
}
.sm-project-left h4,
.sm-project-right h4 {
  font-size: 18px;
  margin-top: 16px;
  margin-bottom: 12px;
  color: #333;
}
.sm-project-left p {
  font-size: 14px;
  line-height: 1.6;
  margin: 10px 0;
  word-break: break-word;
}
.sm-project-remarks {
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Assignment Header */
.sm-assignments-header {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:14px;
  gap: 12px;
}

/* Assignment Add Button - Touch-friendly */
.sm-open-subpanel.small,
.open-assignment-panel.small {
  background:#0073aa; 
  color:#fff;
  padding:10px 16px; 
  border-radius:4px;
  border:none; 
  cursor:pointer; 
  font-size:14px;
  min-height: 44px;
  white-space: nowrap;
}

/* Assignment List */
.sm-assignments-list { 
  display:flex; 
  flex-direction:column; 
  gap:12px; 
}

/* Assignment Row - Card Design */
.sm-assignment-row {
  display:flex;
  flex-direction: column;
  gap: 12px;
  padding:16px 18px;
  border:1px solid #e6e6e6;
  border-radius:6px;
  background:#ffffff;
  box-shadow:0 2px 8px rgba(0,0,0,0.08);
  transition: box-shadow 0.2s ease;
}
.sm-assignment-row:hover {
  box-shadow:0 4px 12px rgba(0,0,0,0.12);
}
.sm-assignment-left {
  flex: 1;
}
.sm-assignment-left strong { 
  font-size:16px; 
  color:#004a7f; 
  display: block;
  margin-bottom: 6px;
  line-height: 1.4;
  word-break: break-word;
}
.sm-assignment-meta { 
  font-size:13px; 
  color:#666; 
  line-height: 1.5;
  margin-top: 4px;
}

/* Actions - Touch-friendly buttons */
.sm-assignment-actions {
  display:flex;
  flex-wrap: wrap;
  gap:8px;
}
.sm-assignment-actions button {
  padding:10px 14px;
  border:none;
  border-radius:4px;
  cursor:pointer;
  font-size:13px;
  background:#0073aa;
  color:#fff;
  min-height: 44px;
  min-width: 70px;
  flex: 1 1 auto;
}
.sm-assignment-actions button.secondary {
  background:#eee;
  color:#333;
}
.sm-assignment-actions button:hover {
  opacity: 0.9;
}

/* No assignments message */
.no-assignments {
  color:#999;
  font-style:italic;
  padding:24px 20px;
  text-align:center;
  font-size: 14px;
}

/* Mobile responsive - below 768px */
@media (max-width:768px){
  /* Viewer full-width mobile layout */
  .sm-project-viewer {
    background: #ffffff;
  }
  
  .sm-project-viewer-inner {
    padding: 16px;
    padding-top: 70px;
    border-radius: 0;
    box-shadow: none;
  }
  
  /* Header - single column on mobile */
  .sm-project-header {
    flex-direction: column;
    gap: 12px;
    padding-top: 70px;
    padding-bottom: 16px;
    margin-bottom: 16px;
  }
  
  .sm-project-title h2 {
    font-size: 20px;
    margin-bottom: 10px;
  }
  
  .sm-project-meta {
    flex-direction: column;
    gap: 6px;
  }
  
  .meta-item {
    font-size: 13px;
  }
  
  /* Single-column body layout */
  .sm-project-body { 
    flex-direction:column;
    gap: 16px;
  }
  
  .sm-project-left h4,
  .sm-project-right h4 {
    font-size: 18px;
    margin-top: 16px;
    margin-bottom: 12px;
  }
  
  .sm-project-left p {
    font-size: 14px;
    line-height: 1.6;
  }
  
  /* Assignments header - stack on mobile */
  .sm-assignments-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .sm-open-subpanel.small,
  .open-assignment-panel.small {
    width: 100%;
    padding: 12px 16px;
  }
  
  /* Assignment cards - more spacing on mobile */
  .sm-assignment-row {
    padding: 14px 16px;
    gap: 10px;
  }
  
  .sm-assignment-left strong {
    font-size: 16px;
    line-height: 1.5;
  }
  
  .sm-assignment-meta {
    font-size: 13px;
    line-height: 1.5;
  }
  
  /* Action buttons stack nicely */
  .sm-assignment-actions {
    width: 100%;
    gap: 8px;
  }
  
  .sm-assignment-actions button {
    flex: 1 1 calc(33.333% - 6px);
    min-width: 0;
    padding: 10px 8px;
    font-size: 12px;
  }
  
  #sm-project-assignments {
    padding: 14px;
  }
  
  /* Close button - more accessible on mobile */
  .sm-project-view-close {
    left: 8px;
    top: 8px;
    padding: 10px 14px;
    font-size: 14px;
  }
  
  /* Subpanel full width on mobile */
  .sm-subpanel {
    width: 100%;
    transform: translateX(100%);
  }
}

/* Extra small screens - 480px and below */
@media (max-width:480px){
  .sm-project-viewer-inner {
    padding: 12px;
    padding-top: 60px;
  }
  
  .sm-project-header {
    padding-top: 60px;
  }
  
  .sm-project-title h2 {
    font-size: 18px;
  }
  
  .sm-project-left h4,
  .sm-project-right h4 {
    font-size: 16px;
  }
  
  .sm-assignment-row {
    padding: 12px 14px;
  }
  
  .sm-assignment-left strong {
    font-size: 15px;
  }
  
  .sm-assignment-actions button {
    font-size: 11px;
    padding: 10px 6px;
  }
}

/* TASK FORM PANEL (HALF SCREEN - Same styling as subpanel) */
.sm-taskpanel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 100002;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease;
}
.sm-taskpanel-overlay.sm-open {
    opacity: 1;
    visibility: visible;
}

.sm-taskpanel {
    position: fixed;
    top: 0;
    right: 0;
    width: 40%;
    height: 100%;
    background: #fff;
    z-index: 100003;
    transform: translateX(100%);
    transition: transform .25s ease;
    overflow-y: auto;
    padding: 20px;
    box-shadow: -4px 0 12px rgba(0,0,0,0.2);
}
.sm-taskpanel.sm-open {
    transform: translateX(0);
}

.sm-taskpanel-close {
    position: absolute;
    left: 12px;
    top: 12px;
    background: transparent;
    border: none;
    font-size: 28px;
    cursor: pointer;
}

/* Mobile task panel */
@media (max-width:800px) {
  .sm-taskpanel {
    width: 100%;
    transform: translateX(100%);
  }
}

/* FULL-PAGE ASSIGNMENT VIEWER */
.sm-assignment-fullpage {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 130000;
  display: none;
  align-items: center;
  justify-content: center;
}

.sm-assignment-fullpage.sm-open { display: flex; }

.sm-assignment-fullpage-inner {
  width: 100%;
  max-width: 980px;
  height: 100%;
  background: #fff;
  overflow-y: auto;
  padding: 28px;
  transform: translateY(12px);
  opacity: 0;
  transition: transform .18s ease, opacity .18s ease;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  position: relative;
}

.sm-assignment-fullpage.sm-open .sm-assignment-fullpage-inner {
  transform: translateY(0);
  opacity: 1;
}

.sm-assignment-fullpage-close {
  position: fixed;
  left: 16px;
  top: 16px;
  padding: 8px 12px;
  background: #0073aa;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  z-index: 130001;
}

.sm-assignment-fullpage-content { max-width: 920px; margin: 12px auto 40px; }
.sm-assignment-fullpage-content h2 { color:#0073aa; }

.sm-assignment-meta { color:#444; margin-bottom: 8px; }
.sm-assignment-remarks { color:#666; font-style: italic; margin-top: 12px; }

/* Footer with Add button */
.sm-assignment-fullpage-footer {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding: 12px 28px;
  border-top: 1px solid #ddd;
  display: flex;
  justify-content: flex-end;
}

.sm-add-new-assignment-from-view {
  background: #0073aa;
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}

.sm-add-task-from-assignment {
  background: #0073aa;
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}

/* Task rows in assignment viewer */
.sm-task-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid #e6e6e6;
  border-radius: 6px;
  background: #fcfcfc;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  margin-bottom: 10px;
}

.sm-task-left {
  flex: 1;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.sm-task-photo-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #ddd;
}

.sm-task-info strong {
  font-size: 15px;
  color: #004a7f;
  display: block;
  margin-bottom: 4px;
}

.sm-task-remarks {
  font-size: 13px;
  color: #666;
  margin: 4px 0;
}

.sm-task-assigned {
  font-size: 12px;
  color: #999;
  font-style: italic;
}

.sm-task-actions {
  display: flex;
  gap: 8px;
}

.sm-task-actions button {
  padding: 6px 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  background: #0073aa;
  color: #fff;
  min-height: 44px;
  white-space: nowrap;
}

.sm-task-actions button.secondary {
  background: #eee;
  color: #333;
}

.sm-task-actions button.task-message-btn {
  background: #00a32a;
  color: #fff;
}

.sm-task-actions button.task-message-btn:hover {
  background: #008a20;
}

.no-tasks {
  color: #999;
  font-style: italic;
  padding: 20px;
  text-align: center;
}

/* Mobile */
@media (max-width:800px) {
  .sm-assignment-fullpage-inner {
    width: 100%;
    height: 100%;
    padding: 18px;
    border-radius: 0;
  }
  .sm-assignment-fullpage-close {
    left: 8px;
    top: 8px;
    padding: 6px 10px;
  }
}

/* FULL-PAGE TASK VIEWER */
.sm-task-fullpage {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 140000;
  display: none;
  align-items: center;
  justify-content: center;
}

.sm-task-fullpage.sm-open { display: flex; }

.sm-task-fullpage-inner {
  width: 100%;
  max-width: 980px;
  height: 100%;
  background: #fff;
  overflow-y: auto;
  padding: 28px;
  transform: translateY(12px);
  opacity: 0;
  transition: transform .18s ease, opacity .18s ease;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  position: relative;
}

.sm-task-fullpage.sm-open .sm-task-fullpage-inner {
  transform: translateY(0);
  opacity: 1;
}

.sm-task-fullpage-close {
  position: fixed;
  left: 16px;
  top: 16px;
  padding: 8px 12px;
  background: #0073aa;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  z-index: 140001;
}

.sm-task-fullpage-content { max-width: 920px; margin: 12px auto 40px; }
.sm-task-fullpage-content h2 { color:#0073aa; }

.sm-task-photo-full {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 20px 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Mobile */
@media (max-width:800px) {
  .sm-task-fullpage-inner {
    width: 100%;
    height: 100%;
    padding: 18px;
    border-radius: 0;
  }
  .sm-task-fullpage-close {
    left: 8px;
    top: 8px;
    padding: 6px 10px;
  }
}

/* ========================================
   SHARED ASSIGNMENT VIEWER (NO LOGIN)
   ======================================== */
.sm-shared-viewer {
  position: fixed;
  inset: 0;
  background: #f5f5f5;
  z-index: 150000;
  overflow-y: auto;
  padding: 20px;
}

.sm-shared-inner {
  max-width: 900px;
  margin: 0 auto;
  background: #fff;
  padding: 32px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.sm-shared-header {
  border-bottom: 2px solid #0073aa;
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.sm-shared-header h2 {
  margin: 0 0 8px 0;
  color: #0073aa;
  font-size: 26px;
}

.sm-shared-project {
  color: #666;
  font-size: 14px;
  margin: 0;
}

.sm-shared-details {
  background: #f9f9f9;
  padding: 16px;
  border-radius: 6px;
  margin-bottom: 24px;
}

.sm-shared-details p {
  margin: 8px 0;
  font-size: 14px;
  color: #333;
}

.sm-shared-notes-section h3 {
  color: #333;
  margin-bottom: 16px;
  font-size: 20px;
}

.sm-shared-notes-list {
  margin-bottom: 24px;
}

.sm-shared-note {
  background: #fafafa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 14px;
  margin-bottom: 12px;
  position: relative;
}

.sm-shared-note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.sm-shared-note-header strong {
  color: #0073aa;
  font-size: 15px;
}

.sm-shared-note-date {
  color: #999;
  font-size: 12px;
}

.sm-shared-note-text {
  color: #333;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.sm-delete-shared-note {
  margin-top: 10px;
  padding: 4px 10px;
  background: #dc3232;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.sm-delete-shared-note:hover {
  background: #c02020;
}

.no-notes {
  color: #999;
  font-style: italic;
  text-align: center;
  padding: 24px;
}

.sm-shared-note-form {
  background: #f0f7fb;
  border: 2px solid #0073aa;
  border-radius: 8px;
  padding: 20px;
  margin-top: 24px;
}

.sm-shared-note-form h4 {
  margin-top: 0;
  color: #0073aa;
  font-size: 18px;
}

.sm-shared-note-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: #333;
}

.sm-shared-note-form input,
.sm-shared-note-form textarea {
  font-family: inherit;
  font-size: 14px;
}

.sm-shared-submit {
  background: #0073aa;
  color: #fff;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
}

.sm-shared-submit:hover {
  background: #005a87;
}

.sm-shared-error {
  text-align: center;
  padding: 40px 20px;
}

.sm-shared-error h2 {
  color: #dc3232;
  margin-bottom: 12px;
}

.sm-shared-error p {
  color: #666;
}

/* Share Modal */
.sm-share-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 160000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sm-share-modal-inner {
  background: #fff;
  padding: 28px;
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
  position: relative;
}

.sm-share-modal-close {
  position: absolute;
  right: 12px;
  top: 12px;
  background: transparent;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #999;
  line-height: 1;
}

.sm-share-modal-close:hover {
  color: #333;
}

.sm-share-modal-inner h3 {
  color: #0073aa;
  margin-top: 0;
  margin-bottom: 16px;
}

.sm-share-url-box {
  margin: 16px 0;
}

.sm-copy-btn {
  background: #0073aa;
  color: #fff;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.sm-copy-btn:hover {
  background: #005a87;
}

/* Share button in assignment actions */
.sm-assignment-actions .sm-share-assign {
  background: #21759b;
  color: #fff;
}

.sm-assignment-actions .sm-share-assign:hover {
  background: #1a5f7a;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .sm-shared-inner {
    padding: 20px;
  }
  
  .sm-shared-header h2 {
    font-size: 22px;
  }
  
  .sm-share-modal-inner {
    padding: 20px;
    width: 95%;
  }
}

/* ========================================
   TASK MESSAGE MODAL (Admin)
   ======================================== */
.sm-task-msg-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 160000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sm-task-msg-modal-inner {
  background: #fff;
  padding: 28px;
  border-radius: 8px;
  max-width: 700px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
  position: relative;
}

.sm-task-msg-modal-close {
  position: absolute;
  right: 16px;
  top: 16px;
  background: transparent;
  border: none;
  font-size: 32px;
  cursor: pointer;
  color: #999;
  line-height: 1;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sm-task-msg-modal-close:hover {
  color: #333;
}

.sm-task-msg-modal-inner h3 {
  color: #0073aa;
  margin-top: 0;
  margin-bottom: 20px;
  padding-right: 40px;
}

.sm-task-msg-list {
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 20px;
  padding: 10px;
  background: #f9f9f9;
  border-radius: 6px;
}

.sm-task-msg-item {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 10px;
}

.sm-task-msg-item:last-child {
  margin-bottom: 0;
}

.sm-msg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.sm-msg-header strong {
  color: #0073aa;
  font-size: 14px;
}

.sm-msg-text {
  color: #333;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.sm-task-msg-form {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #ddd;
}

.sm-task-msg-form label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: #333;
}

.sm-task-msg-form input,
.sm-task-msg-form textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  box-sizing: border-box;
}

.sm-task-msg-form textarea {
  resize: vertical;
  min-height: 80px;
}

.sm-task-msg-form button[type="submit"] {
  background: #0073aa;
  color: #fff;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  min-height: 44px;
}

.sm-task-msg-form button[type="submit"]:hover {
  background: #005a87;
}

.no-messages {
  text-align: center;
  color: #999;
  padding: 20px;
  font-style: italic;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .sm-task-msg-modal-inner {
    width: 95%;
    max-width: 100%;
    padding: 20px;
    max-height: 90vh;
  }
  
  .sm-task-msg-modal-inner h3 {
    font-size: 18px;
    padding-right: 35px;
  }
  
  .sm-task-msg-modal-close {
    right: 12px;
    top: 12px;
    font-size: 28px;
  }
  
  .sm-task-msg-list {
    max-height: 300px;
  }
}

/* ========================================
   ENHANCED SHARED VIEWER - TASKS & MEDIA
   ======================================== */
.sm-shared-tasks-section {
  margin-bottom: 32px;
}

.sm-shared-tasks-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.sm-shared-task-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.sm-task-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.sm-task-header h4 {
  margin: 0;
  color: #0073aa;
  font-size: 16px;
}

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

.sm-status-not-started {
  background: #f0f0f0;
  color: #666;
}

.sm-status-in-progress {
  background: #e3f2fd;
  color: #1976d2;
}

.sm-status-paused {
  background: #fff3e0;
  color: #f57c00;
}

.sm-status-completed {
  background: #e8f5e9;
  color: #388e3c;
}

.sm-status-materials {
  background: #ffebee;
  color: #d32f2f;
}

.sm-task-remarks {
  color: #666;
  font-size: 14px;
  margin-bottom: 12px;
  line-height: 1.5;
}

.sm-task-media {
  margin-bottom: 12px;
}

.sm-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.sm-media-thumb {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #ddd;
  cursor: pointer;
}

.sm-doc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sm-doc-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-decoration: none;
  color: #0073aa;
  font-size: 13px;
}

.sm-doc-link:hover {
  background: #e8e8e8;
}

.sm-open-task-conversation {
  width: 100%;
  padding: 10px;
  background: #0073aa;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.sm-open-task-conversation:hover {
  background: #005a87;
}

/* Task Conversation Panel (Sliding from Right) */
.sm-task-conversation-panel {
  position: fixed;
  right: 0;
  top: 0;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 20px rgba(0,0,0,0.2);
  z-index: 170000;
  overflow-y: auto;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.sm-conversation-inner {
  padding: 24px;
  position: relative;
}

.sm-conversation-close {
  position: absolute;
  right: 16px;
  top: 16px;
  background: transparent;
  border: none;
  font-size: 32px;
  cursor: pointer;
  color: #999;
  line-height: 1;
}

.sm-conversation-close:hover {
  color: #333;
}

.sm-task-comments-list {
  margin: 20px 0;
  max-height: 400px;
  overflow-y: auto;
}

.sm-task-comment {
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 10px;
}

.sm-comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.sm-comment-header strong {
  color: #0073aa;
  font-size: 14px;
}

.sm-comment-date {
  color: #999;
  font-size: 11px;
}

.sm-comment-text {
  color: #333;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.sm-delete-task-comment {
  margin-top: 8px;
  padding: 4px 8px;
  background: #dc3232;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
}

.no-comments {
  color: #999;
  font-style: italic;
  text-align: center;
  padding: 20px;
}

.sm-task-comment-form {
  background: #f0f7fb;
  border: 2px solid #0073aa;
  border-radius: 8px;
  padding: 16px;
  margin-top: 20px;
}

.sm-task-comment-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: #333;
  font-size: 13px;
}

.sm-task-comment-form input,
.sm-task-comment-form textarea,
.sm-task-comment-form select {
  font-family: inherit;
  font-size: 14px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .sm-shared-tasks-list {
    grid-template-columns: 1fr;
  }
  
  .sm-task-conversation-panel {
    width: 100%;
    max-width: 100%;
  }
  
  .sm-conversation-inner {
    padding: 16px;
  }
}