:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --danger: #ef4444;
  --danger-dark: #dc2626;
  --success: #10b981;
  --warning: #f59e0b;
  --dark: #1f2937;
  --gray: #6b7280;
  --light-gray: #f3f4f6;
  --border: #e5e7eb;
  --white: #ffffff;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--light-gray);
  color: var(--dark);
  line-height: 1.6;
}

/* Login Page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-box {
  background: var(--white);
  padding: 40px;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
}

.login-box h1 {
  font-size: 28px;
  margin-bottom: 10px;
  color: var(--dark);
}

.login-box p {
  color: var(--gray);
  margin-bottom: 30px;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--dark);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-dark);
}

.btn-secondary {
  background: var(--gray);
  color: var(--white);
}

.btn-secondary:hover:not(:disabled) {
  background: #4b5563;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

/* Dashboard Layout */
.dashboard {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  font-size: 20px;
  margin-bottom: 5px;
}

.sidebar-header .user-info {
  font-size: 12px;
  color: var(--gray);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border);
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top-bar {
  background: var(--white);
  padding: 15px 30px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.search-bar {
  flex: 1;
  max-width: 500px;
  margin-right: 20px;
}

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

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 30px;
}

/* Categories */
.categories-section {
  margin-bottom: 20px;
}

.categories-section h3 {
  font-size: 14px;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 10px;
}

.category-item {
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

.category-item:hover {
  background: var(--light-gray);
}

.category-item.active {
  background: var(--primary);
  color: var(--white);
}

.category-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.category-count {
  font-size: 12px;
  opacity: 0.7;
}

/* Password List */
.password-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.password-card {
  background: var(--white);
  padding: 20px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.2s;
}

.password-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.password-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 10px;
}

.password-card h3 {
  font-size: 16px;
  margin-bottom: 5px;
}

.password-card .username {
  font-size: 14px;
  color: var(--gray);
}

.password-card .url {
  font-size: 12px;
  color: var(--primary);
  margin-top: 5px;
  display: block;
  text-decoration: none;
}

.password-card .category-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

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

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--white);
  padding: 30px;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-header h2 {
  font-size: 22px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--gray);
}

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

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* Password Input Group */
.password-input-group {
  position: relative;
}

.password-input-group input {
  padding-right: 80px;
}

.password-input-actions {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 5px;
}

/* Table */
.table-container {
  background: var(--white);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--light-gray);
}

th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  color: var(--dark);
}

td {
  padding: 12px;
  border-top: 1px solid var(--border);
  font-size: 14px;
}

.table-actions {
  display: flex;
  gap: 10px;
}

/* Alert */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 14px;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

/* Utilities */
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-between { justify-content: space-between; }
.flex-center { justify-content: center; align-items: center; }
.gap-10 { gap: 10px; }
.hidden { display: none; }

/* Loading Spinner */
.spinner {
  border: 2px solid var(--light-gray);
  border-top: 2px solid var(--primary);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
  .dashboard {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
  }

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