/* =========================================
   Global Styles
   ========================================= */
body {
  font-family: "Montserrat", sans-serif;
  background: #0f0f0f;
  color: #fff;
  margin: 0;
  padding: 0;
}

a {
  text-decoration: none;
}

/* =========================================
   Header
   ========================================= */
header {
  display: flex;
  justify-content: space-between; /* space-between sabse safe */
  align-items: center;
  background: #1a1a1a;
  padding: 15px 40px;
  border-bottom: 2px solid #b5ff18;
  position: relative;
}

/* Nav ko center mein fix karte hain */
nav {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  justify-content: center;
  gap: 24px;
  z-index: 1;
}
nav a {
  color: #fff;
  font-weight: 500;
  transition: color 0.3s;
}
nav a.active,
nav a:hover {
  color: #b5ff18;
}
.logo {
  position: relative;
  z-index: 2;
}

.logo-text a {
  font-size: 1.3rem;
  font-weight: 700;
  color: #b5ff18;
}

/* =========================================
   Snippet Display Section
   ========================================= */
.snippet-display-section {
  padding: 40px;
}

.snippet-display-section h1 {
  text-align: center;
  margin-bottom: 40px;
  font-size: 2rem;
  color: #b5ff18;
}

.snippet-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  justify-content: center;
  align-items: start;
}

.snippet-card {
  background: #1a1a1a;
  border: 2px solid #2a2a2a;
  border-radius: 15px;
  padding: 20px;
  height: 270px;
  width: 100%;
  box-sizing: border-box;
  transition: transform 0.3s, border-color 0.3s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.snippet-card:hover {
  transform: translateY(-5px);
  border-color: #b5ff18;
}

.snippet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.snippet-header h2 {
  font-size: 1.2rem;
  margin: 0;
}

.lang-tag {
  background: #b5ff18;
  color: #000;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
}

.snippet-desc {
  color: #ccc;
  font-size: 0.95rem;
  margin: 8px 0;
  line-height: 1.4;
  max-height: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* =========================================
   Buttons
   ========================================= */
.view-btn {
  background: transparent;
  color: #b5ff18;
  border: 1.5px solid #b5ff18;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.view-btn:hover {
  background: #b5ff18;
  color: #000;
}

.card-actions {
  display: flex;
  gap: 8px;
}

.edit-btn {
  background: transparent;
  color: #b5ff18;
  border: 1.5px solid #b5ff18;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}
.edit-btn:hover {
  background: #b5ff18;
  color: #000;
}


.delete-btn {
  background-color: red;
  color: #fff;
  border: none;
  padding: 7px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
  font-size: 0.95rem;
  box-shadow: 0 2px 6px 0 #28282888;
}
.delete-btn:hover {
  background-color: white;
  color: red;
  box-shadow: 0 4px 10px 0 #ff444488;
}

#save-btn,
#cancel-btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

#save-btn {
  background: #28a745;
  color: #fff;
  border: 1.5px solid #28a745;
}

#save-btn:hover {
  background: transparent;
  color: #28a745;
  border-color: #28a745;
}

#cancel-btn {
  background: transparent;
  color: #ccc;
  border: 1.5px solid #555;
}

#cancel-btn:hover {
  background: #555;
  color: #fff;
}

.empty-msg {
  text-align: center;
  font-size: 1rem;
  color: #aaa;
  margin-top: 40px;
}

/* =========================================
   Modal
   ========================================= */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 15, 15, 0.9);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #1a1a1a;
  border: 2px solid #b5ff18;
  border-radius: 15px;
  padding: 25px;
  max-width: 1000px;
  width: 95%;
  color: #fff;
  box-shadow: 0 0 20px #000;
  position: relative;
}


.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 1.5rem;
  cursor: pointer;
  color: #b5ff18;
  transition: transform 0.2s;
}

.close-btn:hover {
  transform: scale(1.2);
}

#modal-title {
  font-size: 1.5rem;
  margin-bottom: 10px;
  color: #b5ff18;
}

#modal-lang {
  font-size: 0.9rem;
  color: #aaa;
  margin-bottom: 20px;
}

#modal-code {
  background: #1e1e1e;
  color: #ffffff;
  padding: 12px;
  border-radius: 8px;
  font-family: "Fira Code", monospace;
  font-size: 14px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 400px;
}

/* =========================================
   Syntax Highlighting (Java)
   ========================================= */
.keyword {
  color: #c792ea;
  font-weight: 600;
}
.datatype {
  color: #82aaff;
}
.class {
  color: #ffcb6b;
}
.method {
  color: #89ddff;
}
.string {
  color: #c3e88d;
}
.number {
  color: #f78c6c;
}
.comment {
  color: #757575;
  font-style: italic;
}

/* =========================================
   Search Bar
   ========================================= */
.search-bar {
  text-align: center;
  margin-bottom: 30px;
}

#search-input {
  width: 60%;
  max-width: 500px;
  padding: 12px 18px;
  border-radius: 10px;
  border: 2px solid #2a2a2a;
  background: #1a1a1a;
  color: #fff;
  font-size: 1rem;
  outline: none;
  transition: all 0.3s ease;
  font-family: "Montserrat", sans-serif;
}

#search-input:focus {
  border-color: #b5ff18;
  box-shadow: 0 0 10px rgba(181, 255, 24, 0.4);
}

#search-input::placeholder {
  color: #888;
}
#modal-edit-code{
  background: #1e1e1e;
  color: #ffffff;
  padding: 12px;
  border-radius: 8px;
  font-family: "Fira Code", monospace;
  font-size: 14px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 400px;
}