/* public_upload.css - styling for the public upload page (/ctnupload/).
   Rules copied from user_main.php so the page matches the portal branding. */

  * { box-sizing: border-box; }

  /* Light theme variables */
  :root[data-theme="light"] {
    --bg-primary: #f5f5f5;
    --bg-secondary: white;
    --text-primary: #333;
    --text-secondary: #666;
    --text-tertiary: #999;
    --border-color: #e0e0e0;
    --border-secondary: #ddd;
    --header-bg: #2E55A5;
    --header-text: white;
    --button-primary: #2E55A5;
    --button-primary-hover: #1a3966;
    --button-warning: #FFC03C;
    --button-warning-hover: #ffb824;
    --card-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --upload-area-bg: #f0f4fa;
    --upload-area-border: #2E55A5;
    --modal-overlay: rgba(0,0,0,0.5);
    --file-card-bg: #f8f9fa;
    --file-card-hover-shadow: 0 4px 12px rgba(0,0,0,0.1);
  }

  /* Dark theme variables */
  :root[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-tertiary: #707070;
    --border-color: #404040;
    --border-secondary: #505050;
    --header-bg: #1a2d5a;
    --header-text: #e0e0e0;
    --button-primary: #2d4a85;  /* Darker blue - was #3a5aa5 */
    --button-primary-hover: #253d6e;  /* Darker hover - was #2a4985 */
    --button-warning: #cc8800;  /* Darker yellow - was #FFB300 */
    --button-warning-hover: #b37700;  /* Darker hover - was #FFA000 */
    --card-shadow: 0 2px 10px rgba(0,0,0,0.3);
    --upload-area-bg: #252525;
    --upload-area-border: #4a6aa5;
    --modal-overlay: rgba(0,0,0,0.7);
    --file-card-bg: #353535;
    --file-card-hover-shadow: 0 4px 12px rgba(0,0,0,0.3);
    --folder-bg-start: #4a3d1a;  /* Dark yellow-brown */
    --folder-bg-end: #3d3315;  /* Darker yellow-brown */
    --folder-border: #8b6914;  /* Dark golden rod */
    --folder-accent: #705610;  /* Even darker for accents */
    --folder-hover-bg-start: #5a4a20;  /* Slightly lighter on hover */
    --folder-hover-bg-end: #4a3d1a;
    --folder-hover-border: #9b7414;
  }

  body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    margin: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
  }
  
  .header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--card-shadow);
    flex-wrap: wrap;
    gap: 15px;
  }
  .header-left {
    display: flex;
    align-items: center;
    gap: 15px;
  }
  .header-logo {
    height: 40px;
    width: auto;
  }
  .header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
  }
  .container {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
  }
  
  @media (max-width: 768px) {
    .container {
      margin: 20px auto;
      padding: 0 15px;
    }
  }
  
  /* Cards */
  .card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--card-shadow);
  }
  .card h2 {
    margin: 0 0 20px 0;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
  }

  .upload-area {
    background: var(--upload-area-bg);
    border: 2px dashed var(--upload-area-border);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    transition: all 0.2s;
    position: relative;
  }
  .upload-area.dragover {
    background: #fff3d6;
    border-color: var(--button-warning);
    transform: scale(1.02);
  }
  .upload-area p {
    margin: 0 0 20px 0;
    color: var(--button-primary);
    font-size: 16px;
  }
  .upload-area strong {
    font-weight: 600;
  }
  .browse-label {
    color: #2E55A5;
    cursor: pointer;
    text-decoration: underline;
    font-weight: 500;
  }
  .hidden {
    display: none !important;
  }

  /* Advanced Settings Toggle Button */
  .btn {
    cursor: pointer;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
  }
  .btn-primary {
    background: var(--button-primary);
    color: white;
  }
  .btn-primary:hover {
    background: var(--button-primary-hover);
  }
  .btn-danger {
    background: #f44336;
    color: white;
  }
  [data-theme="dark"] .btn-danger {
    background: #a02020;
  }
  .btn-danger:hover {
    background: #d32f2f;
  }
  [data-theme="dark"] .btn-danger:hover {
    background: #801818;
  }
  .btn-secondary {
    background: #9e9e9e;
    color: white;
    padding: 6px 12px;
    font-size: 13px;
  }
  [data-theme="dark"] .btn-secondary {
    background: #5a5a5a;
  }
  .btn-secondary:hover {
    background: #757575;
  }
  [data-theme="dark"] .btn-secondary:hover {
    background: #484848;
  }
  
  /* Upload Queue */
  .upload-queue {
    background: var(--file-card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 16px;
    margin-top: 16px;
  }
  .upload-queue.hidden { display: none; }
  .upload-queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 14px;
  }
  .upload-queue-eta {
    font-size: 13px;
    color: var(--text-secondary);
  }
  .upload-queue-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .upload-queue-close {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 18px;
    line-height: 1;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s;
  }
  .upload-queue-close:hover {
    background: var(--button-warning);
    color: white;
  }
  .upload-queue-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .upload-queue-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--file-card-bg);
    color: var(--text-primary);
    font-size: 14px;
  }
  .upload-queue-item.current {
    border-color: var(--button-primary);
    box-shadow: 0 0 0 1px var(--button-primary);
  }
  .upload-queue-item.done { opacity: 0.85; }
  .upload-queue-item.error {
    border-color: #c0392b;
    color: #c0392b;
  }
  .upload-queue-icon {
    width: 22px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
  }
  .upload-queue-name {
    flex: 1;
    word-break: break-word;
  }
  .upload-queue-size {
    color: var(--text-secondary);
    font-size: 12px;
    flex-shrink: 0;
  }

  /* Progress Section */
  .progress-card {
    margin-top: 20px;
  }
  .worker-status {
    margin-bottom: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
  }
  .worker-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
    color: #555;
    flex-wrap: wrap;
    gap: 8px;
  }
  .worker-name {
    font-weight: 600;
    color: #333;
  }
  .worker-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    flex-wrap: wrap;
  }
  .worker-progress {
    width: 100%;
    height: 20px;
    background: #e8e8e8;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
  }
  .worker-bar {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #45a049 100%);
    transition: width 0.3s ease;
    position: relative;
  }
  .worker-bar.stalled {
    background: linear-gradient(90deg, #ff9800 0%, #f57c00 100%);
  }
  .worker-bar.error {
    background: linear-gradient(90deg, #f44336 0%, #d32f2f 100%);
  }
  .progress-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 600;
    color: #333;
    text-shadow: 0 0 3px rgba(255,255,255,0.8);
  }
  .overall-stats {
    margin-top: 20px;
    padding: 16px;
    background: #f0f4fa;
    border-radius: 8px;
    border: 2px solid #2E55A5;
  }
  .overall-stats strong {
    display: block;
    margin-bottom: 12px;
    color: #2E55A5;
    font-size: 16px;
  }
  .overall-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
  }
  .stat-item {
    text-align: center;
  }
  .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #2E55A5;
  }
  .stat-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    margin-top: 4px;
  }
  
  @media (max-width: 768px) {
    .overall-stats-grid {
      grid-template-columns: repeat(2, 1fr);
    }
    .stat-value {
      font-size: 20px;
    }
  }
  .modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--modal-overlay);
    align-items: center;
    justify-content: center;
    z-index: 1000;
  }

  .modal.show {
    display: flex;
  }

  .modal-content {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
  }

  .modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0;
  }

  .modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

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

  .form-group {
    margin-bottom: 20px;
  }

  .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
  }

  .form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
  }

  .form-group input:focus {
    outline: none;
    border-color: #2E55A5;
  }

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

  .btn-modal {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
  }

  .btn-modal-primary {
    background: #2E55A5;
    color: white;
  }

  .btn-modal-primary:hover {
    background: #1e3a70;
  }

  .btn-modal-cancel {
    background: #e0e0e0;
    color: #333;
  }

  .btn-modal-cancel:hover {
    background: #d0d0d0;
  }
  
