* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  background: #0f0f0f;
  color: #e0e0e0;
}

body {
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  min-height: 100vh;
  width: 100%;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* Login Screen */
#loginScreen {
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.login-container {
  background: #1e1e2e;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  max-width: 400px;
  width: 100%;
  border: 1px solid #333;
}

.login-container h1 {
  text-align: center;
  color: #6366f1;
  margin-bottom: 10px;
  font-size: 28px;
}

.subtitle {
  text-align: center;
  color: #a0a0a0;
  margin-bottom: 30px;
  font-size: 14px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.pin-container {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 10px;
}

.pin-input {
  width: 50px;
  height: 50px;
  text-align: center;
  font-size: 24px;
  font-weight: 600;
  padding: 0;
  border: 2px solid #333;
  border-radius: 8px;
  background: #2a2a3e;
  color: #e0e0e0;
  transition: all 0.3s;
  -webkit-appearance: none;
  appearance: none;
  -webkit-font-size-adjust: none;
}

.pin-input:focus {
  outline: none;
  border-color: #6366f1;
  background: #333548;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.login-form button {
  margin-top: 10px;
}

.login-form input[type="text"]:not(.pin-input) {
  padding: 12px 16px;
  border: 2px solid #333;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s;
  background: #2a2a3e;
  color: #e0e0e0;
}

.login-form input[type="text"]:not(.pin-input):focus {
  outline: none;
  border-color: #6366f1;
  background: #333548;
}

.error-message {
  color: #ff6b6b;
  font-size: 14px;
  margin-top: 10px;
  display: none;
}

.error-message.show {
  display: block;
}

/* File Storage Screen */
#fileScreen {
  flex-direction: column;
  background: #0f0f0f;
  padding: 20px;
  gap: 20px;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  color: #e0e0e0;
  padding-bottom: 20px;
  border-bottom: 1px solid #333;
}

.header h1 {
  font-size: 32px;
}

.header-buttons {
  display: flex;
  gap: 10px;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
}

.btn-primary {
  background: #6366f1;
  color: white;
}

.btn-primary:hover {
  background: #4f46e5;
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(99, 102, 241, 0.2);
  color: #6366f1;
  border: 2px solid #6366f1;
}

.btn-secondary:hover {
  background: rgba(99, 102, 241, 0.3);
}

.btn-warning {
  background: #f59e0b;
  color: white;
  border: 2px solid #f59e0b;
}

.btn-warning:hover {
  background: #d97706;
}

.btn-danger {
  background: #ef4444;
  color: white;
  padding: 8px 16px;
  font-size: 14px;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-success {
  background: #10b981;
  color: white;
  padding: 8px 16px;
  font-size: 14px;
}

.btn-success:hover {
  background: #059669;
}

/* Drag and Drop */
.drop-zone {
  background: #1e1e2e;
  border: 3px dashed #6366f1;
  border-radius: 12px;
  padding: 60px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  border: 2px solid #333;
}

.drop-zone:hover {
  border-color: #6366f1;
  background: #2a2a3e;
}

.drop-zone.dragover {
  border-color: #10b981;
  background: #1a3a2a;
  transform: scale(1.02);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.icon-upload {
  width: 60px;
  height: 60px;
  color: #6366f1;
}

.drop-zone h2 {
  color: #e0e0e0;
  font-size: 24px;
  margin-bottom: 5px;
}

.drop-zone p {
  color: #808080;
  font-size: 14px;
}

/* Upload Progress */
.upload-progress {
  background: #1e1e2e;
  border-radius: 12px;
  padding: 20px;
  margin-top: -10px;
  border: 1px solid #333;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #333;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  width: 0%;
  transition: width 0.2s;
}

#progressText {
  text-align: center;
  color: #a0a0a0;
  font-size: 14px;
}

/* Files Section */
.files-section {
  background: #1e1e2e;
  border-radius: 12px;
  padding: 30px 20px;
  border: 1px solid #333;
}

.files-section h2 {
  color: #e0e0e0;
  margin-bottom: 20px;
  font-size: 20px;
}

.files-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-message {
  color: #666;
  text-align: center;
  padding: 40px 20px;
  font-size: 14px;
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: #2a2a3e;
  border-radius: 8px;
  border-left: 4px solid #6366f1;
  transition: all 0.3s;
}

.file-item:hover {
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
  background: #333348;
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  color: #e0e0e0;
  font-weight: 600;
  word-break: break-word;
  margin-bottom: 5px;
}

.file-meta {
  display: flex;
  gap: 15px;
  font-size: 12px;
  color: #808080;
}

.file-actions {
  display: flex;
  gap: 10px;
  margin-left: 10px;
  flex-shrink: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }

  .header h1 {
    font-size: 24px;
  }

  #fileScreen {
    padding: 15px;
  }

  .login-container {
    padding: 30px 20px;
  }

  .drop-zone {
    padding: 40px 15px;
  }

  .drop-zone h2 {
    font-size: 18px;
  }

  .icon-upload {
    width: 48px;
    height: 48px;
  }

  .file-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .file-actions {
    width: 100%;
    margin-left: 0;
    margin-top: 10px;
  }

  .file-actions button {
    flex: 1;
  }

  .btn {
    padding: 10px 16px;
    font-size: 14px;
  }

  .files-section {
    padding: 20px 15px;
  }
}

@media (max-width: 480px) {
  .header {
    flex-direction: column;
    gap: 10px;
  }

  .header h1 {
    font-size: 20px;
  }

  .header-buttons {
    width: 100%;
    flex-direction: column;
    gap: 8px;
  }

  .header-buttons .btn {
    width: 100%;
  }

  .login-container h1 {
    font-size: 22px;
  }

  .pin-container {
    gap: 8px;
    margin-bottom: 15px;
  }

  .pin-input {
    width: 60px;
    height: 60px;
    font-size: 28px;
  }

  .drop-zone {
    padding: 30px 10px;
  }

  .drop-zone h2 {
    font-size: 16px;
  }

  .drop-zone p {
    font-size: 12px;
  }

  .icon-upload {
    width: 40px;
    height: 40px;
  }

  .file-meta {
    flex-direction: column;
    gap: 3px;
  }

  .btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  .file-item {
    padding: 10px;
  }
}

/* Extra small screens (360px and below) */
@media (max-width: 360px) {
  html,
  body {
    font-size: 13px;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  #loginScreen {
    padding: 8px;
  }

  .screen {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .login-container {
    padding: 12px 10px;
    border-radius: 8px;
    width: calc(100% - 16px);
    max-width: calc(100% - 16px);
  }

  .login-container h1 {
    font-size: 17px;
    margin-bottom: 5px;
  }

  .subtitle {
    font-size: 10px;
    margin-bottom: 10px;
  }

  .pin-container {
    gap: 4px;
    margin-bottom: 8px;
  }

  .pin-input {
    width: 40px;
    height: 40px;
    font-size: 19px;
    border-radius: 5px;
  }

  .login-form {
    gap: 8px;
  }

  .btn {
    padding: 7px 10px;
    font-size: 11px;
    border-radius: 5px;
  }

  .error-message {
    font-size: 10px;
    margin-top: 5px;
  }

  #fileScreen {
    padding: 6px;
    gap: 10px;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .container {
    width: calc(100% - 8px);
    max-width: calc(100% - 8px);
    padding: 2px;
  }

  .header {
    flex-direction: column;
    gap: 6px;
    align-items: center;
    text-align: center;
    margin-bottom: 10px;
    padding-bottom: 6px;
  }

  .header h1 {
    font-size: 16px;
  }

  .header button {
    width: 100%;
  }

  .main-content {
    gap: 10px;
  }

  .drop-zone {
    padding: 14px 6px;
    border-radius: 8px;
    min-height: auto;
    width: calc(100% - 12px);
  }

  .drop-zone-content {
    gap: 8px;
  }

  .drop-zone h2 {
    font-size: 13px;
  }

  .drop-zone p {
    font-size: 9px;
  }

  .icon-upload {
    width: 30px;
    height: 30px;
  }

  .upload-progress {
    padding: 10px;
    border-radius: 8px;
    width: calc(100% - 20px);
  }

  .progress-bar {
    height: 5px;
    margin-bottom: 6px;
  }

  #progressText {
    font-size: 10px;
  }

  .files-section {
    padding: 10px 8px;
    border-radius: 8px;
    width: calc(100% - 16px);
  }

  .files-section h2 {
    font-size: 14px;
    margin-bottom: 8px;
  }

  .file-item {
    padding: 6px;
    flex-direction: column;
    gap: 3px;
  }

  .file-item:hover {
    box-shadow: 0 2px 5px rgba(99, 102, 241, 0.12);
  }

  .file-name {
    font-size: 11px;
    word-break: break-all;
  }

  .file-meta {
    flex-direction: column;
    gap: 1px;
    font-size: 8px;
  }

  .file-actions {
    width: 100%;
    gap: 4px;
    margin-left: 0;
  }

  .file-actions button {
    flex: 1;
    padding: 5px 6px;
    font-size: 9px;
  }

  .empty-message {
    padding: 16px 8px;
    font-size: 10px;
  }
}

/* Ultra small screens (320px and below) */
@media (max-width: 320px) {
  * {
    margin: 0;
    padding: 0;
  }

  html,
  body {
    font-size: 12px;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
  }

  body {
    display: flex;
    flex-direction: column;
  }

  .screen {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    min-height: 100vh;
  }

  #loginScreen {
    padding: 5px 0;
    justify-content: center;
    align-items: center;
  }

  .login-container {
    padding: 10px 8px;
    border-radius: 6px;
    width: calc(100% - 16px);
    max-width: 100%;
  }

  .login-container h1 {
    font-size: 15px;
    margin-bottom: 2px;
  }

  .subtitle {
    font-size: 9px;
    margin-bottom: 8px;
  }

  .pin-container {
    gap: 2px;
    margin-bottom: 6px;
    justify-content: center;
  }

  .pin-input {
    width: 32px;
    height: 32px;
    font-size: 14px;
    border: 1px solid #333;
    border-radius: 3px;
    flex-shrink: 0;
  }

  .login-form {
    gap: 8px;
  }

  .btn {
    padding: 6px 8px;
    font-size: 10px;
    border-radius: 3px;
  }

  .error-message {
    font-size: 9px;
    margin-top: 4px;
  }

  #fileScreen {
    padding: 5px 0;
    gap: 8px;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .container {
    width: calc(100% - 8px);
    max-width: 100%;
    padding: 4px;
    margin: 0 auto;
  }

  .header {
    flex-direction: column;
    gap: 6px;
    align-items: center;
    text-align: center;
    margin-bottom: 8px;
    padding-bottom: 4px;
  }

  .header h1 {
    font-size: 14px;
    margin: 0;
    word-break: break-word;
  }

  .header button {
    width: 100%;
    padding: 4px 6px;
    font-size: 9px;
  }

  .main-content {
    gap: 8px;
  }

  .drop-zone {
    padding: 10px 4px;
    border-radius: 5px;
    min-height: auto;
    border: 1px solid #333;
    width: calc(100% - 8px);
  }

  .drop-zone-content {
    gap: 6px;
  }

  .drop-zone h2 {
    font-size: 11px;
    margin: 0;
  }

  .drop-zone p {
    font-size: 8px;
    margin: 0;
  }

  .icon-upload {
    width: 24px;
    height: 24px;
  }

  .upload-progress {
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #333;
    width: calc(100% - 16px);
  }

  .progress-bar {
    height: 4px;
    margin-bottom: 4px;
  }

  #progressText {
    font-size: 9px;
    margin: 0;
  }

  .files-section {
    padding: 8px 6px;
    border-radius: 5px;
    border: 1px solid #333;
    width: calc(100% - 12px);
  }

  .files-section h2 {
    font-size: 12px;
    margin: 0 0 6px 0;
  }

  .files-list {
    gap: 4px;
  }

  .file-item {
    padding: 4px;
    flex-direction: column;
    gap: 2px;
    border-left-width: 2px;
    border-radius: 3px;
  }

  .file-item:hover {
    box-shadow: 0 1px 2px rgba(99, 102, 241, 0.1);
  }

  .file-name {
    font-size: 10px;
    word-break: break-all;
    margin: 0;
    line-height: 1.2;
  }

  .file-meta {
    flex-direction: column;
    gap: 0;
    font-size: 7px;
  }

  .file-meta span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .file-actions {
    width: 100%;
    gap: 2px;
    margin-left: 0;
  }

  .file-actions button {
    flex: 1;
    padding: 3px 4px;
    font-size: 8px;
  }

  .empty-message {
    padding: 10px 4px;
    font-size: 9px;
    margin: 0;
  }
}

/* Extreme aspect ratio - very wide but short (landscape on small phone) */
@media (max-width: 600px) and (max-height: 300px) {
  .pin-input {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .pin-container {
    gap: 1px;
    margin-bottom: 4px;
  }

  .login-form button {
    padding: 4px 6px;
    font-size: 10px;
  }

  .subtitle {
    font-size: 8px;
    margin-bottom: 6px;
  }

  .login-container h1 {
    font-size: 13px;
    margin-bottom: 2px;
  }
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Success message */
.success-message {
  color: #10b981;
  font-size: 14px;
  margin-top: 10px;
  display: none;
}

.success-message.show {
  display: block;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: #1e1e2e;
  border-radius: 12px;
  padding: 20px;
  max-width: 500px;
  width: 90%;
  border: 1px solid #333;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #333;
}

.modal-header h2 {
  color: #e0e0e0;
  font-size: 20px;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: #e0e0e0;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s;
}

.modal-close:hover {
  color: #6366f1;
}

.modal-body {
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  color: #a0a0a0;
  font-size: 13px;
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #333;
  border-radius: 6px;
  background: #2a2a3e;
  color: #e0e0e0;
  font-size: 14px;
  transition: border-color 0.3s;
  box-sizing: border-box;
}

.form-group input:focus {
  outline: none;
  border-color: #6366f1;
}

.modal-text {
  color: #a0a0a0;
  font-size: 14px;
  margin-bottom: 15px;
}

.modal-text strong {
  color: #6366f1;
}

.share-link-container {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.share-link-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #333;
  border-radius: 8px;
  background: #2a2a3e;
  color: #e0e0e0;
  font-size: 13px;
  word-break: break-all;
  font-family: monospace;
}

.share-link-input:focus {
  outline: none;
  border-color: #6366f1;
}

.modal-hint {
  color: #666;
  font-size: 12px;
  margin-bottom: 0;
  font-style: italic;
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal-footer .btn {
  padding: 10px 20px;
}

/* Responsive modal */
@media (max-width: 480px) {
  .modal-content {
    width: 95%;
    padding: 15px;
  }

  .modal-header h2 {
    font-size: 16px;
  }

  .share-link-container {
    flex-direction: column;
    gap: 8px;
  }

  .share-link-input {
    font-size: 12px;
    padding: 10px 12px;
  }

  .modal-footer {
    flex-direction: column;
  }

  .modal-footer .btn {
    width: 100%;
  }
}
