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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.header h1 {
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.backup-status {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 14px;
    margin-top: 15px;
    display: inline-block;
}

.backup-status.error {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.tab-container {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.tab {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.tab.active {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.tab-content {
    display: none;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.upload-area {
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.02);
}

.upload-area.dragover {
    background: rgba(102, 126, 234, 0.2);
    border-color: #764ba2;
}

input[type="file"] {
    display: none;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.input-group input, .input-group textarea, .input-group select {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e1e1;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.input-group input:focus, .input-group textarea:focus, .input-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.2);
}

.tags-input-container {
    position: relative;
}

.tags-display {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    min-height: 40px;
    align-items: center;
}

.tag {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tag .remove-tag {
    cursor: pointer;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: #6c757d;
    margin-left: 10px;
}

.btn-backup {
    background: #28a745;
    margin-left: 10px;
}

.memory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.memory-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.memory-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(45deg, #667eea, #764ba2);
}

.memory-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.memory-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.memory-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.memory-meta {
    text-align: right;
    font-size: 0.9rem;
}

.memory-date {
    color: #666;
}

.memory-category {
    background: #17a2b8;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-top: 5px;
    display: inline-block;
}

.memory-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 15px;
}

.memory-text {
    color: #555;
    line-height: 1.6;
    margin-bottom: 15px;
}

.memory-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 15px;
}

.memory-tag {
    background: #f8f9fa;
    color: #495057;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    border: 1px solid #dee2e6;
}

.copy-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: #218838;
    transform: scale(1.05);
}

.copy-btn.copied {
    background: #17a2b8;
}

.search-filter-container {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

.search-box {
    padding: 15px;
    border: 2px solid #e1e1e1;
    border-radius: 10px;
    font-size: 16px;
}

.filter-select {
    min-width: 200px;
}

.no-memories {
    text-align: center;
    color: #666;
    font-size: 1.2rem;
    padding: 40px;
}

.delete-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 10px;
}

.delete-btn:hover {
    background: #c82333;
}

.cloud-storage-setup {
    background: #e9ecef;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.cloud-storage-setup h3 {
    margin-bottom: 15px;
    color: #495057;
}

.storage-option {
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.storage-option:hover {
    border-color: #667eea;
}

.storage-option.active {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.backup-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

/* === Extra styles to match script.js behavior === */
.tag-chip{
  background: linear-gradient(45deg,#667eea,#764ba2);
  color:#fff;
  padding:6px 12px;
  border-radius:20px;
  font-size:12px;
  display:inline-flex;
  align-items:center;
  gap:6px;
}

.img-thumb{
  position:relative;
  width:120px;
  height:120px;
  border-radius:12px;
  overflow:hidden;
  box-shadow:0 6px 16px rgba(0,0,0,.12);
}
.img-thumb img{ width:100%; height:100%; object-fit:cover; display:block; }
.thumb-remove{
  position:absolute;
  top:6px; right:6px;
  border:none; border-radius:50%;
  background:rgba(220,53,69,.95);
  color:#fff; width:24px; height:24px;
  cursor:pointer; font-weight:700; line-height:24px;
  box-shadow:0 4px 10px rgba(220,53,69,.35);
}
.thumb-remove:hover{ filter:brightness(1.05); transform:scale(1.06); }

.gallery{ display:flex; gap:10px; overflow-x:auto; margin-bottom:15px; }
.gallery img{ height:150px; flex-shrink:0; border-radius:10px; }

.tagbar{ display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }

.btn-sm{
  padding:6px 10px; font-size:12px; border-radius:12px;
  border:none; cursor:pointer;
  background:#6c757d; color:#fff;
}
.btn-sm:hover{ filter:brightness(1.05); }

.btn-danger{ background:#dc3545 !important; }
.btn-danger:hover{ background:#c82333 !important; }

#image-preview{
  display:flex; gap:10px; flex-wrap:wrap; margin-top:10px;
}

.search-box, .filter-select{
  background:#fff; border:2px solid #e1e1e1;
  border-radius:10px;
}
.search-box:focus, .filter-select:focus{
  outline:none; border-color:#667eea;
  box-shadow:0 0 12px rgba(102,126,234,.2);
}

@keyframes slideIn{ from{ transform:translateY(-8px); opacity:0 } to{ transform:translateY(0); opacity:1 } }

@media (max-width: 768px) {
    .container { padding: 10px; }
    .header h1 { font-size: 2rem; }
    .memory-grid { grid-template-columns: 1fr; }
    .tab-container { flex-direction: column; align-items: center; }
    .search-filter-container { grid-template-columns: 1fr; }
    .gallery img{ height:130px; }
    .img-thumb{ width:100px; height:100px; }
}
