:root {
  --primary: #4361ee;
  --secondary: #3f37c9;
  --dark: #1b263b;
  --light: #f8f9fa;
  --success: #4cc9f0;
  --danger: #f72585;
}

.sidebar {
  height: 100vh;
  width: 250px;
  position: fixed;
  top: 0;
  left: -290px;
  background-color: #000000ad;
  overflow-x: hidden;
  backdrop-filter: blur(5px);
  transition: 0.3s;
  padding-top: 60px;
  z-index: 10000;
  box-shadow: 2px 2px 20px black;
}

.sidebar a {
  padding: 10px 15px;
  text-decoration: none;
  font-size: 18px;
  color: rgb(255, 255, 255);
  display: block;

}

/* Close button inside sidebar */
.sidebar .closebtn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 30px;
  cursor: pointer;
  color: rgb(255, 255, 255);
}

/* Open button */
.openbtn {
  font-size: 20px;
  cursor: pointer;
  background-color: white;
  color: black;
  padding: 10px 15px;
  border: none;
  margin: 10px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  background: #000000e1;
  min-height: 100vh;
  color: var(--dark);
}

/* HEADER */
header {
  display: flex;
  align-items: center;
  padding: 1rem 2rem;
  background: rgba(0, 0, 0, 0.389);
  backdrop-filter: blur(5px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  margin-left: -20px;
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: -20px;
}

@media (max-width:480px) {
  .logo {
    margin-left: -20px;
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: -25px;
  }
}

.logo img {
  width: 2rem;
  height: 2rem;
  margin-left: -20px;
  margin-bottom: 0px;
}

.logo h2 {
  font-size: 1.5rem;
  font-weight: 600;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  color: transparent;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-left: 2rem;
  font-size: .9rem;
  margin-top: -20px;
}

.breadcrumbs span {
  cursor: pointer;
  color: var(--primary);
  padding: .3rem .5rem;
  border-radius: .3rem;
  transition: .2s;
}

.breadcrumbs span:hover {
  background: rgba(67, 97, 238, 0.1);
}

.breadcrumbs .separator {
  color: #999;
  cursor: default;
}

.search-bar {
  margin-left: auto;
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.9);
  padding: .5rem 1rem;
  border-radius: 2rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border: thin solid white;
}

.search-input {
  border: none;
  background: transparent;
  padding: .5rem;
  outline: none;
  min-width: 200px;
  color: white;
}

.search-button {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--primary);
  margin-left: 0.5rem;
}

.auth-actions button {
  margin-left: .5rem;
}

/* MAIN */
main {
  padding: 2rem;
}

@media (max-width:480px) {
  main {
    padding: 1rem;
  }
}

.title {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 2rem;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  color: transparent;
  font-weight: 700;
}

.empty-state {
  text-align: center;
  grid-column: 1/-1;
  color: #666;
}

.empty-state i {
  font-size: 3rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

/* CARD */
.card {

  padding: 1.5rem;
  transition: .3s;
  cursor: pointer;
  padding-top: 4px;
  padding-bottom: 8px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  min-height: 100px;
  border-top: 1px solid rgba(136, 0, 255, 0.3);
  border-bottom: 1px solid rgba(136, 0, 255, 0.3);
  margin-bottom: 10px;
  background-color: rgba(0, 0, 0, 0.252);
  border-radius: 10px;
}

.card p {
  margin: 0;
  padding-top: 4px;
  padding-bottom: 8px;
  font-size: 0.85rem;
  color: white;
  white-space: pre-wrap;
  line-height: 1.4;
}

.uploading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 1rem;
  z-index: 2;
}

.progress-bar {
  width: 80%;
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  margin-top: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--success);
  width: 0%;
  transition: width 0.3s ease;
}

.card-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.file-icon {
  color: var(--success);
}

.folder-icon {
  color: var(--primary);
}

.url-icon {
  color: var(--danger);
}

.note-icon {
  color: #fbc02d;
}

.card h3 {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: .5rem;
  word-break: break-word;
  width: 100%;
  color: #9e98ff;
}

.file-size {
  font-size: .8rem;
  color: #666;
}

.file-date {
  font-size: .7rem;
  color: #999;
}

.card .search-highlight {
  background-color: yellow;
  padding: 2px;
  border: none;
}

/* ACTION BUTTONS ON CARD */
.action-buttons {
  position: absolute;
  top: .5rem;
  right: .5rem;
  display: flex;
  gap: .5rem;
}

.action-btn {
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: .5rem;
  padding: .3rem .6rem;
  cursor: pointer;
  transition: .2s;
}

.action-btn:hover {
  background: var(--primary);
}

/* FLOATING ADD BUTTONS */
.floating-btn {
  padding: 10px 15px;
  text-decoration: none;
  font-size: 18px;
  color: rgb(255, 255, 255);
  display: block;
}

#addUrlBtn {
  right: 7rem;
  background: linear-gradient(135deg, var(--danger), #d00000);
}

#addNoteBtn {
  right: 12rem;
  background: linear-gradient(135deg, #fbc02d, #f9a825);
}

/* MODALS */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: .3s;
  z-index: 20;
}

.modal.active {
  visibility: visible;
  opacity: 1;
}

.modal-content {
  background: white;
  border-radius: 1rem;
  width: 90%;
  max-width: 500px;
  padding: 2rem;
  transform: translateY(20px);
  transition: .3s;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
  max-height: 80vh;
  overflow-y: auto;
}

.modal.active .modal-content {
  transform: translateY(0);
}

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

.modal-header h2 {
  color: var(--dark);
  font-size: 1.5rem;
}

.close-modal {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #999;
  transition: .2s;
}

.close-modal:hover {
  color: var(--danger);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: .5rem;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: .8rem 1rem;
  border: 1px solid #ddd;
  border-radius: .5rem;
  font-size: 1rem;
  transition: .2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
}

textarea.form-control {
  resize: vertical;
  height: 200px;
}

.btn {
  padding: .8rem 1.5rem;
  border: none;
  border-radius: .5rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: .2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(67, 97, 238, 0.3);
}

.btn-secondary {
  background: #f5f7fa;
  color: #666;
}

.btn-secondary:hover {
  background: #eee;
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #d00000);
  color: white;
}

/* DRAG & DROP */
.file-upload {
  border: 2px dashed #ddd;
  padding: 2rem;
  text-align: center;
  border-radius: 1rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.5);
  transition: .3s;
}

.file-upload:hover {
  border-color: var(--primary);
  background: rgba(67, 97, 238, 0.05);
}

.file-upload.active {
  border-color: var(--success);
  background: rgba(76, 201, 240, 0.05);
}

.file-upload i {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: .5rem;
}

.file-upload p {
  color: #666;
  font-size: .9rem;
}

/* LOADING SPINNER */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: none;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 5;
}

.spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid white;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* NOTE VIEW */
#noteView {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgb(33, 27, 27);
  display: none;
  flex-direction: column;
  padding: 1rem;
  overflow-y: auto;
  z-index: 15;
}

#noteView #viewTitle {
  color: white;
}

#noteView #viewContent {
  color: white;
  font-size: 20px;
}

.notetitle {
  font-size: 20px;
  margin-bottom: 30px;
}

@media (max-width:480px) {
  #noteView #viewContent {
    color: white;
    font-size: 15px;
  }

  .notetitle {
    font-size: 15px;
  }
}

#noteView.active {
  display: flex;
}

#backViewBtn {
  background-color: white;
  color: rgb(0, 0, 0);
  border: none;
  padding: .3rem .6rem;
  width: 80px;
  /* fixed button width */
  text-align: center;
  /* center the “Back” text */
  border-radius: .5rem;
  cursor: pointer;
  margin-bottom: 1rem;
}

.error-message {
  color: var(--danger);
  display: none;
  font-size: .9rem;
  margin-top: .5rem;
}

.queue-indicator {
  position: fixed;
  bottom: 7rem;
  right: 2rem;
  background: var(--dark);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 1rem;
  font-size: 0.9rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  z-index: 4;
}

/* Sequential upload placeholder */
.placeholder-card {
  background: rgba(200, 200, 200, 0.2);
  border: 1px dashed #999;
  opacity: 0.8;
}

/* Loading more indicator */
.loading-more {
  text-align: center;
  padding: 20px;
  color: #666;
  display: none;
}

/* Load More Button */
.load-more-container {
  text-align: center;
  margin-top: 20px;
  padding: 20px;
}

.load-more-btn {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(67, 97, 238, 0.3);
}

.load-more-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 7px 15px rgba(67, 97, 238, 0.4);
}

.load-more-btn:active {
  transform: translateY(1px);
}

.load-more-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Search results header */
.search-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
}

.search-results-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: white;
}

.clear-search-btn {
  background: var(--danger);
  color: rgb(255, 255, 255);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.2s;

}

.clear-search-btn:hover {
  background: #d00000;
}

#viewContent a {
  color: blue;
  text-decoration: underline;
}


@media (max-width:768px) {
  .container {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

  .breadcrumbs {
    margin-left: 1rem;
    font-size: .8rem;
  }

  header {
    flex-wrap: wrap;
    gap: 1rem;
  }
}

@media (max-width:576px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
  }

  .breadcrumbs {
    margin: 0;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: .5rem;
    margin-top: -30px;
    margin-bottom: -20px;
  }

  .container {
    grid-template-columns: 1fr;
  }

  .modal-content {
    width: 95%;
    padding: 1.5rem;
  }

  .search-bar {
    width: 100%;
    margin-bottom: -20px;
  }

  .search-input {
    width: 100%;
  }
}