body {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    padding-top: 0px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}
hr {
    border: none;
    border-top: 1px solid #333;
}
#receive-code-display {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 10px 0;
    text-align: left;
}
#receive-button,
#send-button {
    height: 40px; /* Match channel-code height */
    box-sizing: border-box;
    padding: 0 15px;
    border: 2px solid #ddd;
    background: #f0f0f0;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 16px;
    color: black
}
#receive-button:hover,
#send-button:not(:disabled):hover {
    background: #e0e0e0;
}
#download-button {
    display: none;
    height: 36px;
    padding: 0 12px;
    background: transparent;
    border: 2px solid #999;
    border-radius: 6px;
    color: #666;
    font-size: 14px;
    font-weight: normal;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

#download-button:hover {
    background: #f5f5f5;
    border-color: #777;
    color: #333;
}

#download-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    border-color: #ccc;
    color: #999;
}

/* Spinner for download button */
#download-button.loading::before {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #ddd;
    border-top-color: #666;
    border-radius: 50%;
    animation: spin-simple 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}
#text-timestamp {
  font-size: 14px;
  color: #666;
  margin-bottom: 5px;
}
.code-input-wrapper {
    position: relative;
    display: inline-block;
    width: 180px;
    height: 40px;
}

#channel-code {
    display: inline-block;
    font-family: inherit;
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 2px;
    color: transparent;
    caret-color: transparent;
    padding: 4px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: #f9f9f9;
    min-width: 180px;
    width: 180px;
    height: 40px;
    text-align: center;
    line-height: 32px;
    outline: none;
    box-sizing: border-box;
    position: relative;
    z-index: 2;
}

#channel-code:focus {
    border-color: #4CAF50;
    background: #fff;
    color: #333;
    caret-color: #333;
    letter-spacing: 4px;
}

#channel-code:focus ~ .code-overlay {
    display: none;
}

.code-input-wrapper.text-mode {
    width: 280px;
}
.text-mode #channel-code,
.text-mode #generated-code {
    color: #333;
    caret-color: #333;
    letter-spacing: normal;
    font-size: 18px;
    width: 280px;
    min-width: 280px;
    text-align: center;
}

#channel-code:focus ~ .code-placeholder {
    display: none !important;
}

.code-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 2px;
    color: #ccc;
    pointer-events: none;
    z-index: 3;
}

.code-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 2px;
    color: #333;
    pointer-events: none;
    z-index: 3;
}

.code-gap {
    width: 6px;
    text-align: center;
    color: #e0e0e0;
    font-size: 14px;
    letter-spacing: 0;
}
.code-gap::before {
    content: '·';
}
textarea, input[type="text"] {
    max-width: 100%;
    box-sizing: border-box;
}
textarea {
    width: 100%;
}
.image-list-container {
    margin-top: 10px;
}
.image-summary {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}
.image-item {
    display: flex;
    align-items: center;
    padding: 5px;
    border-bottom: 1px solid #eee;
}
.remove-btn {
    background: #999;
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    margin-right: 10px;
}
.remove-btn:hover {
    background: #666;
}
.image-thumbnail {
    width: 30px;
    height: 30px;
    object-fit: cover;
    margin-right: 10px;
}
.received-image-thumbnail {
    width: 100px;
    height: 100px;
    object-fit: cover;
    margin-right: 10px;
    cursor: pointer;
}
.image-filename {
    flex: 1;
    font-size: 14px;
}
.image-size {
    font-size: 12px;
    color: #999;
    margin-left: 10px;
    min-width: 65px;
    display: inline-block;
    text-align: right;
}
.download-item-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 3px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    margin-left: 10px;
}
.download-item-btn:hover {
    background: #45a049;
}

#received-files-list {
    margin-top: 10px;
}
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 15px;
}
.file-card {
    cursor: pointer;
    text-align: center;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    transition: transform 0.2s;
}
.file-card:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.file-card-thumbnail {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 8px;
}
.file-card-icon {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    background: #f5f5f5;
    border-radius: 6px;
    margin-bottom: 8px;
}
.file-card-name {
    font-size: 12px;
    word-break: break-word;
    margin-bottom: 4px;
}
.file-card-size {
    font-size: 11px;
    color: #999;
}
/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
}
.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none;     /* IE 10+ */
    user-select: none;         /* Standard */
}
.modal-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}
.modal-close:hover {
    color: #ccc;
}
/* Spinner styles */
.spinner {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 6px;
    margin-bottom: 8px;
}
.spinner::after {
    content: "";
    width: 20px;
    height: 20px;
    border: 3px solid #ddd;
    border-top-color: #666;
    border-radius: 50%;
    animation: spin-simple 0.8s linear infinite;
}
@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}
@keyframes spin-simple {
    to { transform: rotate(360deg); }
}
/* Progress bar styles */
.progress-bar {
    font-family: monospace;
    color: #666;
    font-size: 12px;
    margin: 0 5px;
}
.progress-percent {
    font-size: 12px;
    color: #666;
    margin: 0 5px;
}
.status-text {
    font-size: 12px;
    color: #666;
    margin: 0 5px;
}

/* Retry button */
.retry-btn {
    background: #ff9800;
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    margin-right: 10px;
}
.retry-btn:hover {
    background: #f57c00;
}
.remove-btn:disabled,
.retry-btn:disabled {
    background: #ccc;
    opacity: 0.6;
    cursor: not-allowed;
}
/* Send button disabled state */
#send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}
#text-input {
    font-family: inherit;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    padding: 8px;
}
/* Loading Overlay styles */
    
/* Mode transitions */
.section-wrapper {
    transition: opacity 300ms ease, filter 300ms ease;
}

/* Receive mode - dim send section */
.receive-mode #send-section {
    opacity: 0.6;
    pointer-events: none;
    filter: grayscale(0.3);
}

/* Send mode - dim receive section */
.send-mode #receive-section {
    opacity: 0.6;
    pointer-events: none;
    filter: grayscale(0.3);
}
/* Exclude certain elements from dimming in send mode */
.send-mode #send-section #generated-code-display {
    opacity: 1;
    filter: none;
}
.send-mode #send-section .file-upload-label,
.send-mode #send-section .image-list-container,
.send-mode #send-section label[for="file-input"] {
    opacity: 0.6;
}
/* Mode locked state */
.mode-locked {
    pointer-events: none !important;
}
/* Generated code display */
#generated-code-display {
    display: flex;
    align-items: center;
    margin: 10px 0 15px 0;
    text-align: left;
}
#generated-code-display #send-button {
    margin-left: auto;
}

#generated-code {
    text-align: center;
    font-family: inherit;
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 2px;
    color: transparent;
    caret-color: transparent;
    padding: 4px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: #f9f9f9;
    min-width: 180px;
    width: 180px;
    height: 40px;
    outline: none;
    box-sizing: border-box;
}

#generated-code:focus {
    color: #333;
    caret-color: #333;
    letter-spacing: 4px;
}

#generated-code:focus ~ .code-overlay {
    display: none;
}

#copy-code-btn,
#copy-link-btn,
#refresh-code-btn {
    background: none;
    border: none;
    font-size: 20px;
    padding: 8px;
    color: #ccc;
    cursor: default;
    pointer-events: none;
}
#copy-code-btn {
    margin-left: 10px;
}

#copy-code-btn.active,
#copy-link-btn.active,
#refresh-code-btn.active {
    color: black;
    cursor: pointer;
    pointer-events: auto;
}
#copy-code-btn.active:hover,
#copy-link-btn.active:hover,
#refresh-code-btn.active:hover {
    background: #eee;
    border-radius: 6px;
}

#copy-text-icon-btn {
    background: none;
    border: none;
    font-size: 20px;
    padding: 8px;
    flex-shrink: 0;
    color: #ccc;
    cursor: default;
    pointer-events: none;
}
#received-text-display.has-text ~ #copy-text-icon-btn {
    color: black;
    cursor: pointer;
    pointer-events: auto;
}
#received-text-display.has-text ~ #copy-text-icon-btn:hover {
    background: #eee;
    border-radius: 6px;
}

.code-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #333;
    border-radius: 50%;
    animation: spin 0.5s linear infinite;
}
/* Modal navigation buttons */
.modal-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 150px;
    background: rgba(0, 0, 0, 0.6);
    color: white; /* The SVG stroke="currentColor" will inherit this */
    border: 0px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    border-radius: 8px;
    z-index: 2001;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    /* font-size and font-weight removed */
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.modal-nav-btn:hover {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0);
}

.modal-nav-btn:active {
    background: rgba(0, 0, 0, 0.4);
    transform: translateY(-50%) scale(0.95);
}

.modal-prev {
    left: 10px;
}

.modal-next {
    right: 10px;
}

.modal-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Mobile optimization */
@media (max-width: 768px) {
    .modal-nav-btn {
        width: 50px;
        height: 160px;
        font-size: 32px;
        background: rgba(0, 0, 0, 0.4);
        border: 0px solid rgba(255, 255, 255, 0.4);
    }
    
    .modal-prev {
        left: 5px;
    }
    
    .modal-next {
        right: 5px;
    }
}
/* Received text wrapper */
#received-text-wrapper {
    position: relative;
    margin-top: 15px;
    margin-bottom: 15px;
}

/* Received text display */
#received-text-display {
    flex: 1;
    padding: 8px;
    box-sizing: border-box;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: #f9f9f9;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
    min-height: 40px;
}
#received-text-display.has-text {
    border-color: #4CAF50;
}


#received-text-display a {
    color: #0066cc;
    text-decoration: underline;
}

#received-text-display a:hover {
    color: #0052a3;
}
.disabled-option {
    opacity: 0.4;
    cursor: not-allowed;
}
/* --- App Header Menu --- */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-top: 20px;
    margin-bottom: 10px;
}

.main-header h1 {
    margin: 0;
}

/* --- Header Link Fix --- */
.main-header h1 a {
    color: inherit; /* Makes it use the h1's color */
    text-decoration: none; /* Removes the underline */
}
/* Header Right Container */
.header-right {
    display: flex;
    align-items: center;
}

.header-login-link {
    color: #333;
    text-decoration: none;
    font-size: 14px;
}

.header-login-link:hover {
    text-decoration: underline;
}

.file-upload-label {
    display: block;
    border: 2px dashed #ccc;
    padding: 20px;
    text-align: center;
    border-radius: 6px;
    cursor: pointer;
    background-color: #f9f9f9;
    margin-bottom: 15px;
}

.file-upload-label:hover {
    border-color: #007bff;
    background-color: #f4f8ff;
}
.file-upload-label.drag-active {
    border-color: #007bff;
    background-color: #f4f8ff;
}
.file-upload-label.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: default;
}
.mode-btn.toggle-disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: default;
}
/* Hide the actual file input */
#file-input {
    display: none;
}

/* ==================== Authentication Styles ==================== */

/* Auth tabs */
.auth-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid #ddd;
}

.auth-tab {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  color: #666;
  transition: all 0.3s ease;
}

.auth-tab:hover {
  color: #333;
  background: #f5f5f5;
}

.auth-tab.active {
  color: #333;
  border-bottom-color: #333;
  font-weight: 600;
}

/* Auth forms */
.auth-form {
  max-width: 400px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #333;
}

.form-group input[type="email"],
.form-group input[type="password"] {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
  transition: border-color 0.3s ease;
}

.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus {
  outline: none;
  border-color: #333;
}

.form-group small {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  color: #666;
}

/* Submit button */
.auth-submit-btn {
  width: 100%;
  padding: 12px;
  background: #333;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease;
}

.auth-submit-btn:hover {
  background: #555;
}

.auth-submit-btn:active {
  background: #222;
}

/* Auth message */
.auth-message {
  margin-top: 15px;
  padding: 10px;
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
  display: none;
}

.auth-message:not(:empty) {
  display: block;
}

/* Account info */
.account-info {
  max-width: 600px;
  margin: 20px auto;
  padding: 20px;
  background: #f9f9f9;
  border-radius: 6px;
  border-left: 4px solid #333;
}

.account-info p {
  margin: 10px 0;
  font-size: 16px;
}

.account-info strong {
  color: #333;
  margin-right: 10px;
}

.transfer-mode-toggle {
  display: flex;
  gap: 0;
  margin-top: 8px;
}

.mode-btn {
  padding: 8px 16px;
  border: 2px solid #ddd;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  color: #666;
  transition: all 0.2s ease;
}

.mode-btn:first-child {
  border-radius: 6px 0 0 6px;
  border-right: 1px solid #ddd;
}

.mode-btn:last-child {
  border-radius: 0 6px 6px 0;
  border-left: 1px solid #ddd;
}

.mode-btn.active {
  background: #333;
  color: white;
  border-color: #333;
}

.mode-btn:not(.active):hover {
  background: #f0f0f0;
}

/* Account actions */
.account-actions {
  max-width: 400px;
  margin: 20px auto;
}

/* Responsive design */
@media (max-width: 600px) {
  .auth-form {
    max-width: 100%;
    padding: 0 10px;
  }
  
  .auth-tab {
    padding: 8px 15px;
    font-size: 14px;
  }
  
  .account-info {
    padding: 15px;
  }

  .form-group input[type="email"],
  .form-group input[type="password"] {
    font-size: 16px;
  }

  .main-header {
    padding-top: 5px;
  }

  #generated-code-display {
    flex-wrap: wrap;
  }

  #generated-code-display #send-button {
    width: 100%;
    margin-left: 0;
    margin-top: 8px;
  }

  #generated-code-display .code-input-wrapper.text-mode {
    width: 0;
    min-width: 0;
    flex: 1 1 0;
  }

  .text-mode #generated-code {
    width: 100%;
    min-width: 0;
  }

  #copy-code-btn,
  #copy-link-btn,
  #refresh-code-btn {
    flex-shrink: 0;
  }
}/* ==================== Toast Notification Styles ==================== */

#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: #333;
  color: white;
  padding: 12px 20px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 14px;
  min-width: 250px;
  max-width: 400px;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s ease;
  pointer-events: auto;
}

.toast-show {
  opacity: 1;
  transform: translateX(0);
}

.toast-info {
  background: #2196F3;
}

.toast-success {
  background: #4CAF50;
}

.toast-error {
  background: #f44336;
}

.toast-warning {
  background: #ff9800;
}

/* Mobile responsive */
@media (max-width: 600px) {
  #toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
  }
  
  .toast {
    min-width: auto;
    max-width: none;
  }
}
/* Delete modal */
#delete-modal {
  background-color: rgba(0,0,0,0.2);
}
.modal-dialog {
  background: white;
  padding: 25px;
  border-radius: 8px;
  width: 60%;
  max-width: 400px;
  margin: auto;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.modal-dialog h3 {
  margin: 0 0 10px 0;
  font-size: 20px;
}

/* Site Footer */
.site-footer {
    text-align: center;
    font-size: 12px;
    color: #999;
    padding: 20px 0;
    margin-top: 20px;
}