/* Basic design inspired by modern cloud storage (MEGA-like) */
:root{
  --bg: #0f1724;
  --card: #0b1220;
  --accent: linear-gradient(135deg,#7c4dff,#2fb8ff);
  --muted: #9aa6b2;
  --header-color: #b0c4de; /* Light Steel Blue */
}
*{box-sizing:border-box}
body{
  font-family:Inter,system-ui,Segoe UI,Arial;
  background-color:var(--bg);
  background-image:linear-gradient(180deg,rgba(124,77,255,0.04),transparent);
  background-attachment:fixed;
  min-height:100vh;
  color:#e6eef6;
  margin:0
}

/* Apply to all headings and brand */
h1, h2, h3, h4, h5, h6, .brand {
  color: var(--header-color);
}

.container{max-width:980px;margin:0 auto;padding:32px}
.site-header{background:transparent;padding:18px 0}
.site-header.small{padding:12px 0}
.brand{font-size:20px;margin:0}
.site-header nav{float:right}
.btn{display:inline-block;padding:8px 12px;border-radius:6px;background:transparent;border:1px solid rgba(255,255,255,0.08);color:#fff;text-decoration:none}
.btn.primary{background:var(--accent);border:0;color:#021;}
.hero{padding:40px 0;text-align:left}
.hero h2{font-size:34px;margin:6px 0 12px}
.hero p{color:var(--muted);max-width:700px}
.cta{background:var(--accent);padding:12px 20px;border-radius:10px;color:#021;text-decoration:none}
.features{display:flex;gap:12px;margin-top:16px}
.feature{background:rgba(255,255,255,0.02);padding:12px;border-radius:8px;color:var(--muted)}
.uploader{background:var(--card);border-radius:12px;padding:20px;margin-top:20px}
.drop-zone{border:2px dashed rgba(255,255,255,0.06);padding:32px;text-align:center;border-radius:8px;color:var(--muted);cursor:pointer}
.drop-zone.dragover{background:rgba(47,184,255,0.04);border-color:rgba(47,184,255,0.5)}
.file-list{margin-top:18px}
.file-row{display:flex;gap:12px;align-items:center;padding:10px;border-radius:8px;background:rgba(255,255,255,0.01);margin-bottom:8px}
.progress{height:8px;background:rgba(255,255,255,0.03);border-radius:6px;overflow:hidden;flex:1}
.progress > i{display:block;height:100%;background:var(--accent);width:0}
.muted{color:var(--muted)}
.uploaded-list{margin-top:12px}
.uploaded-item{padding:8px;border-radius:6px;background:rgba(255,255,255,0.01);display:flex;justify-content:space-between;margin-bottom:8px}
.footer{color:var(--muted);text-align:center;padding:20px}
.file-label{color:#8ed2ff;text-decoration:underline;cursor:pointer}

/* Demo uploader styles & animations */
.demo-card{background:linear-gradient(180deg,rgba(255,255,255,0.02),rgba(255,255,255,0.01));border-radius:12px;padding:12px}
.demo-header{font-weight:600;margin-bottom:10px}
.demo-drop{position:relative;border:2px dashed rgba(255,255,255,0.04);padding:18px;border-radius:10px;display:flex;gap:12px;align-items:center;justify-content:space-between}
.demo-hint{position:absolute;left:18px;top:10px;color:var(--muted);font-size:13px}
.demo-files{display:flex;flex-direction:column;gap:8px;margin-right:12px}
.demo-file{background:rgba(255,255,255,0.02);padding:8px 10px;border-radius:8px;cursor:pointer;transition:transform .24s ease,opacity .24s ease; display:flex; align-items:center; gap:8px; font-size:13px}
.demo-file:hover{transform:translateY(-4px); background:rgba(255,255,255,0.05)}
.demo-target{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:10px;border-radius:8px;background:linear-gradient(180deg,rgba(124,77,255,0.12),rgba(47,184,255,0.04));min-width:120px;min-height:90px}

/* flying file animation */
.flying-file{position:fixed;padding:8px 10px;border-radius:8px;background:#122;box-shadow:0 6px 18px rgba(0,0,0,0.5);color:#e6eef6;z-index:9999;pointer-events:none;transform-origin:center center}
@keyframes popIn{0%{transform:scale(.8);opacity:0}50%{transform:scale(1.03);opacity:1}100%{transform:scale(1);opacity:1}}
.pulse-cta{animation:popIn 900ms ease-in-out both}

/* Auth / form styles (professional, compact) */
.auth-card{background:linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));border-radius:12px;padding:28px;max-width:520px;margin:28px auto;color:inherit;box-shadow:0 10px 30px rgba(3,7,18,0.6)}
.auth-header{display:flex;gap:12px;align-items:center;margin-bottom:12px}
.auth-header h2{margin:0;font-size:20px}
.auth-header .muted{font-size:13px}
.auth-form{display:block}
.form-row{margin-bottom:12px}
.form-row label{display:block;font-size:13px;color:var(--muted);margin-bottom:6px}
.form-input{width:100%;padding:10px 12px;border-radius:8px;border:1px solid rgba(255,255,255,0.05);background:rgba(255,255,255,0.02);color:inherit}
.form-input:focus{outline:none;box-shadow:0 8px 20px rgba(47,184,255,0.06);border-color:rgba(47,184,255,0.4)}
.u-errors{background:rgba(255,77,77,0.06);padding:10px;border-radius:8px;margin-bottom:12px}
.u-errors .error-item{color:#ffb4b4;font-size:13px}
.small-note{color:var(--muted);font-size:13px;text-decoration:underline}

/* Modal Dialog - Proper Modal Behavior */
#share-modal-overlay, #share-info-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 99998;
  display: none !important;
}

#share-modal-overlay.active, #share-info-overlay.active {
  display: block !important;
}

#share-modal, #share-info-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 99999;
  background: var(--card);
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
  max-height: 90vh;
  display: none !important;
  flex-direction: column;
  overflow: hidden;
}

#share-modal.active, #share-info-modal.active {
  display: flex !important;
}

#share-info-modal {
  max-width: 600px;
}

.modal-header {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  background: 0;
  border: 0;
  color: inherit;
  font-size: 24px;
  cursor: pointer;
  opacity: 0.6;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease;
}

.modal-close:hover {
  opacity: 1;
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* Share Modal Enhancements */
.share-form-group{margin-bottom:16px}
.share-form-group label{display:block;font-size:13px;font-weight:600;color:#e6eef6;margin-bottom:8px}
.share-form-group small{display:block;margin-top:4px}

.checkbox-label{display:flex;align-items:center;gap:8px;cursor:pointer;font-weight:400;color:#e6eef6}
.checkbox-label input[type="checkbox"]{cursor:pointer;width:16px;height:16px}

select.form-input{appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%239aa6b2' d='M0 0l6 8 6-8z'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center;padding-right:36px}

/* Share Info Modal */
.share-info-dialog{max-width:600px}
.share-info-section{padding:16px 0;border-bottom:1px solid rgba(255,255,255,0.05)}
.share-info-section:last-child{border-bottom:0}

.share-info-label{font-size:13px;font-weight:600;color:#e6eef6;margin-bottom:8px}

.share-link-box{display:flex;gap:8px;align-items:center}
.share-link-input{flex:1;padding:10px 12px;border-radius:8px;border:1px solid rgba(255,255,255,0.08);background:rgba(255,255,255,0.02);color:#e6eef6;font-family:monospace;font-size:12px}
.share-link-input:focus{outline:none;box-shadow:0 0 0 3px rgba(47,184,255,0.1);border-color:rgba(47,184,255,0.4)}

.btn-small{padding:8px 12px;font-size:13px}

.share-details{background:rgba(124,77,255,0.06);padding:12px;border-radius:8px}
.share-detail-row{display:flex;justify-content:space-between;padding:8px 0;font-size:13px}
.detail-label{color:var(--muted);font-weight:500}
.detail-value{color:#8ed2ff;font-weight:600}

/* File Explorer Styles */
.explorer-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 16px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

.crumb {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.crumb:hover {
  background: rgba(255,255,255,0.05);
  color: #fff;
}

.crumb:not(:last-child)::after {
  content: '/';
  margin-left: 8px;
  opacity: 0.4;
}

.crumb:last-child {
  color: #fff;
  font-weight: 600;
  cursor: default;
}

.explorer-actions {
  display: flex;
  gap: 8px;
}

.btn-small {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 6px 12px;
}

.explorer-drop-zone {
  border: 2px dashed rgba(255,255,255,0.06);
  border-radius: 8px;
  min-height: 300px;
  padding: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  text-align: left;
}

.explorer-drop-zone.dragover {
  background: rgba(47,184,255,0.04);
  border-color: rgba(47,184,255,0.5);
}

.drop-message {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  background: rgba(11, 18, 32, 0.8);
  z-index: 10;
}

.explorer-drop-zone.dragover .drop-message {
  opacity: 1;
}

.explorer-view {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.explorer-header {
  display: flex;
  padding: 10px 16px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.explorer-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.col-name { flex: 1; }
.col-size { width: 100px; text-align: right; }
.col-date { width: 160px; text-align: right; margin-left: 16px; }
.col-actions { width: 180px; text-align: right; margin-left: 16px; }

.explorer-item {
  display: flex;
  align-items: center;
  padding: 10px 8px;
  border-radius: 6px;
  transition: background 0.15s;
  cursor: default;
  border-bottom: 1px solid rgba(255,255,255,0.02);
}

.explorer-item:hover {
  background: rgba(255,255,255,0.03);
}

.item-icon {
  width: 24px;
  height: 24px;
  margin-right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.item-name {
  flex: 1;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #e6eef6;
}

.is-folder .item-name {
  cursor: pointer;
}

.is-folder .item-name:hover {
  text-decoration: underline;
}

.is-folder .item-icon {
  color: #ffd700; /* Gold for folders */
}

.item-meta {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
}

.item-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  opacity: 0.4;
  transition: opacity 0.2s;
}

.explorer-item:hover .item-actions {
  opacity: 1;
}

.action-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 12px;
}

.action-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.action-btn.delete:hover {
  background: rgba(255, 77, 77, 0.2);
  color: #ff6b6b;
}

/* Sortable Headers */
.sortable {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 4px;
}
.sortable:hover {
  color: #fff;
}
.sort-icon::after {
  content: '↕';
  opacity: 0.3;
  font-size: 10px;
}
.sortable.asc .sort-icon::after {
  content: '▲';
  opacity: 1;
}
.sortable.desc .sort-icon::after {
  content: '▼';
  opacity: 1;
}

/* Preview Modal */
#preview-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 99999;
  max-width: 95vw;
  max-height: 95vh;
  display: none !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#preview-modal.active {
  display: flex !important;
}

#preview-content {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

#preview-content img, #preview-content video {
  max-width: 100%;
  max-height: 80vh;
  display: block;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  border-radius: 4px;
}

#preview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 99998;
  display: none !important;
}
#preview-overlay.active { display: block !important; }
#preview-modal.active { display: flex !important; }

/* Search Box Focus */
.search-box input:focus {
  background: rgba(0,0,0,0.4) !important;
  border-color: rgba(47,184,255,0.5) !important;
}

/* AI Chat Panel */
.ai-chat-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 360px;
  height: 500px;
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  z-index: 10000;
  overflow: hidden;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.ai-chat-header {
  padding: 12px 16px;
  background: rgba(124,77,255,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 14px;
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-message {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 85%;
  word-wrap: break-word;
}

.ai-message.system {
  align-self: center;
  background: rgba(255,255,255,0.05);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.ai-message.user {
  align-self: flex-end;
  background: #2fb8ff;
  color: #000;
  border-bottom-right-radius: 2px;
}

.ai-message.ai {
  align-self: flex-start;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-bottom-left-radius: 2px;
}

.ai-chat-input-area {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex;
  gap: 8px;
  background: rgba(0,0,0,0.2);
}

#ai-chat-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 8px 12px;
  color: #fff;
  font-size: 13px;
}

#ai-chat-input:focus {
  outline: none;
  border-color: #7c4dff;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .container {
    padding: 16px;
  }

  /* Header adjustments */
  .site-header .container {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 16px;
  }
  
  .site-header nav {
    width: 100%;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  
  .site-header nav .btn {
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Uploader Toolbar */
  .explorer-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .explorer-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }

  .explorer-actions .btn-small {
    flex: 1 1 auto;
    justify-content: center;
    min-width: 100px;
  }
  
  #storage-select {
    width: 100%;
    max-width: none !important;
  }

  /* AI Chat Panel */
  .ai-chat-panel {
    width: calc(100% - 32px);
    right: 16px;
    bottom: 16px;
    height: 60vh;
    max-height: 500px;
  }
}

@media (max-width: 640px) {
  .features {
    flex-direction: column;
  }
  
  .auth-card {
    margin: 16px 0;
    padding: 20px;
  }
  
  .modal-dialog {
    width: 95%;
    max-width: 100%;
    max-height: 80vh;
  }
  
  .share-link-box {
    flex-direction: column;
    align-items: stretch;
  }
  
  .share-link-box .btn-small {
    width: 100%;
    margin-top: 8px;
  }

  /* File List Mobile View */
  .col-size, .col-date { 
    display: none; 
  }
  
  .explorer-header { 
    display: none; 
  }
  
  .explorer-item { 
    flex-wrap: wrap; 
    padding: 12px;
    gap: 8px;
  }
  
  .item-icon {
    margin-right: 8px;
  }
  
  .item-name { 
    width: calc(100% - 40px); 
    font-size: 14px;
  }
  
  /* Show size in mobile view */
  .explorer-item .col-size.item-meta {
      display: block;
      width: auto;
      text-align: left;
      font-size: 12px;
      color: var(--muted);
  }

  .col-actions { 
    width: 100%; 
    margin: 8px 0 0 0; 
    text-align: left; 
  }
  
  .item-actions { 
    justify-content: flex-start; 
    opacity: 1; 
    width: 100%;
    gap: 12px;
  }
  
  .action-btn {
    padding: 8px 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 6px;
    color: #e6eef6;
  }
  
  /* Hide breadcrumbs overflow */
  .breadcrumbs {
      overflow-x: auto;
      white-space: nowrap;
      padding-bottom: 4px;
      width: 100%;
  }
}