:root {
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --success: #22c55e;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
}

.container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

/* Auth Screen */
#auth-screen {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.auth-box {
  background: var(--card-bg);
  padding: 2.5rem;
  border-radius: 1rem;
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.5),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  text-align: center;
  width: 90%;
  max-width: 400px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-box h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.auth-box p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 0.875rem;
}

/* Inputs & Buttons */
/* Inputs & Buttons */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  color: white;
  font-size: 1rem;
  transition: all 0.2s;
  margin-bottom: 1rem;
}

input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
}

.btn {
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Vault View */
header {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.action-bar {
    display: flex;
    gap: 1rem;
    width: 100%;
}

.secondary-btn {
    width: auto;
    background: var(--card-bg);
}

.primary-btn {
    width: auto;
    white-space: nowrap;
}

/* Search Bar */
.search-container {
    flex-grow: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
    pointer-events: none;
}

#search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.8rem;
    margin-bottom: 0;
    border-radius: 99px; /* Pill shape */
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#search-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
}

/* Grid & Card */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.card {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
    border-color: var(--accent);
}

/* Form Modal */
.form-modal {
    background: #1e293b;
    border-radius: 1rem;
    width: 100%;
    max-width: 500px;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-header {
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.input-with-icon {
    position: relative;
}

.input-with-icon input {
    padding-right: 2.5rem;
}

.input-with-icon .icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-100%); /* Fix vertical align */
    pointer-events: none;
    opacity: 0.5;
}

textarea {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: white;
    font-size: 0.9rem;
    resize: vertical;
}

select {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: white;
    font-size: 1rem;
    appearance: none; /* Remove default arrow */
    cursor: pointer;
}

select option {
    background: #1e293b;
    color: white;
}

.full-width {
    width: 100%;
    margin-top: 1rem;
}

/* Card Detail View in List */
.card-preview {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 180px;
    background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(0,0,0,0.2));
    position: relative;
}

.card-brand-logo {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-weight: bold;
    font-style: italic;
    opacity: 0.8;
}

.card-number-display {
    font-family: 'Courier New', monospace;
    font-size: 1.25rem;
    letter-spacing: 2px;
    margin-top: auto;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.card-holder-display {
    font-weight: 600;
    color: white;
}

.has-image-indicator {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-size: 1.2rem;
}

/* Detail Modal */
.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 0.5rem;
}

.detail-label {
    color: var(--text-secondary);
}

.detail-value {
    font-weight: 600;
}

.card-info {
    padding: 1rem;
}

.card-image-container {
  height: 180px;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  cursor: pointer;
}

.card-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s;
}

.card-image-container.blur img {
  filter: blur(8px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.card-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%;
}

.card-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
    opacity: 0.7;
}

.delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    opacity: 1;
}

.danger-text {
  color: var(--danger);
  font-size: 0.75rem;
  margin-top: 1rem;
  display: block;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  max-width: 95vw;
  max-height: 95vh;
}

.modal-content img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 0.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.close-modal {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hidden {
  display: none !important;
}

.spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Custom File Upload */
.custom-file-upload {
    position: relative;
    width: 100%;
    margin-bottom: 1rem;
}

.custom-file-upload input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.file-label-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.3);
    border-radius: 0.5rem;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.custom-file-upload:hover .file-label-btn {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.close-form {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    line-height: 1;
    display: flex;
    align-items: center;
}

.close-form:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}
