/* ===== Apple Glassmorphism Design ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  background: #f5f5f7;
  color: #1d1d1f;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.6s ease;
}
::selection { background: rgba(0, 122, 255, 0.12); }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.08); border-radius: 2px; }

.container { display: grid; grid-template-columns: 1.618fr 1fr; gap: 20px; max-width: 980px; margin: 0 auto; padding: 20px 20px; position: relative; z-index: 1; }

/* ===== Wallpaper with subtle scrim ===== */
#wallpaper-overlay {
  position: fixed; inset: 0; z-index: 0;
  background-size: cover; background-position: center;
  transition: background-image 0.8s ease;
}
#wallpaper-scrim {
  position: fixed; inset: 0; z-index: 0;
  background: linear-gradient(135deg, rgba(0,0,0,0.02) 0%, rgba(0,0,0,0.08) 100%);
  display: none;
}
body.wp-active #wallpaper-scrim { display: block; }


/* ===== Login (Glass when wp-active) ===== */
#login-overlay {
  position: fixed; inset: 0; z-index: 10 !important;
  display: flex; align-items: center; justify-content: center;
  background: #f5f5f7;
}
#login-overlay.hidden { display: none; }
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 40px 36px 36px;
  width: 380px;
  max-width: 88vw;
  text-align: center;
  box-shadow: 0 2px 24px rgba(0,0,0,0.04), 0 1px 4px rgba(0,0,0,0.02);
  transition: all 0.4s ease;
}
.login-card h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.5px; color: #1d1d1f; margin-bottom: 2px; }
.login-card p { color: #86868b; font-size: 14px; margin-bottom: 28px; }
.login-card input { width: 100%; padding: 12px 16px; background: #f5f5f7; border: none; border-radius: 12px; color: #1d1d1f; font-size: 15px; outline: none; margin-bottom: 10px; transition: background 0.2s; }
.login-card input:focus { background: #e8e8ed; }
.login-card input::placeholder { color: #aeaeb2; }
.login-card .error { color: #ff3b30; font-size: 13px; display: none; margin-bottom: 10px; }
.login-btn { width: 100%; padding: 12px; background: #007aff; border: none; border-radius: 12px; color: #fff; font-size: 16px; font-weight: 500; cursor: pointer; transition: opacity 0.2s; }
.login-btn:hover { opacity: 0.85; }

/* Glass login when wallpaper is active */
body.wp-active #login-overlay { background: rgba(0,0,0,0.15); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
body.wp-active .login-card { background: rgba(255,255,255,0.08); backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px); border: 1px solid rgba(255,255,255,0.12); }
body.wp-active .login-card h1 { color: #fff; }
body.wp-active .login-card p { color: rgba(255,255,255,0.5); }
body.wp-active .login-card input { background: rgba(255,255,255,0.08); color: #fff; }
body.wp-active .login-card input:focus { background: rgba(255,255,255,0.12); }
body.wp-active .login-card input::placeholder { color: rgba(255,255,255,0.3); }

/* ===== Header ===== */
.header { grid-column: 1 / -1; text-align: center; padding: 28px 0 0; position: relative; }
.admin-gear { position: absolute; top: 16px; right: 0; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #86868b; font-size: 17px; text-decoration: none; border-radius: 50%; transition: background 0.2s; }
.admin-gear:hover { background: rgba(0,0,0,0.04); }
.brand { font-size: 12px; letter-spacing: 3px; color: #aeaeb2; margin-bottom: 6px; text-transform: uppercase; transition: color 0.4s ease; }
.greeting { font-size: 32px; font-weight: 700; letter-spacing: -0.3px; color: #1d1d1f; transition: color 0.4s ease; }
.meta { color: #86868b; font-size: 13px; margin-top: 3px; transition: color 0.4s ease; }
/* Header glass when wallpaper active */
body.wp-active .brand { color: rgba(255,255,255,0.5); }
body.wp-active .greeting { color: #fff; }
body.wp-active .meta { color: rgba(255,255,255,0.5); }
body.wp-active .admin-gear { color: rgba(255,255,255,0.5); }
body.wp-active .admin-gear:hover { background: rgba(255,255,255,0.08); }

/* ===== Search (Glass panel) ===== */
.search-wrap { grid-column: 1 / -1;
  max-width: 560px; margin: 20px auto;
  display: flex; align-items: center;
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 14px;
  padding: 2px 2px 2px 16px;
  transition: box-shadow 0.3s, border-color 0.3s, background 0.4s ease;
}
.search-wrap:focus-within { border-color: #007aff; box-shadow: 0 0 0 2px rgba(0,122,255,0.1); }
.search-wrap input { flex: 1; background: transparent; border: none; outline: none; color: #1d1d1f; font-size: 15px; padding: 10px 0; }
.search-wrap input::placeholder { color: #aeaeb2; }
.search-engines { display: flex; gap: 2px; }
.search-engines button { padding: 7px 14px; border: none; border-radius: 11px; background: transparent; color: #8e8e93; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.search-engines button:hover { background: rgba(0,122,255,0.05); color: #007aff; }
.search-engines button.active { background: rgba(0,122,255,0.08); color: #007aff; }

/* Glass search when wallpaper active */
body.wp-active .search-wrap { background: rgba(255,255,255,0.15); backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px); border: 1px solid rgba(255,255,255,0.12); }
body.wp-active .search-wrap input { color: #fff; }
body.wp-active .search-wrap input::placeholder { color: rgba(255,255,255,0.3); }
body.wp-active .search-engines button { color: rgba(255,255,255,0.4); }
body.wp-active .search-engines button:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.8); }
body.wp-active .search-engines button.active { background: rgba(255,255,255,0.1); color: #fff; }

/* ===== Probe ===== */
.probe { padding: 0; }
.probe-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid rgba(0,0,0,0.04); }
.probe-header h3 { font-size: 11px; font-weight: 600; color: #86868b; letter-spacing: 0.5px; text-transform: uppercase; }
.probe-header .status { font-size: 11px; color: #34c759; background: rgba(52,199,89,0.08); padding: 3px 10px; border-radius: 20px; font-weight: 500; }
.probe-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.probe-item { padding: 10px 0; }
.probe-item .label { font-size: 11px; color: #aeaeb2; font-weight: 500; margin-bottom: 1px; }
.probe-item .value { font-size: 17px; font-weight: 700; letter-spacing: -0.2px; color: #1d1d1f; }
.probe-item .bar-wrap { height: 3px; background: rgba(0,0,0,0.04); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.probe-item .bar { height: 100%; border-radius: 2px; transition: width 0.8s ease; }

/* Probe glass when wallpaper active */
body.wp-active .probe { background: rgba(255,255,255,0.06); backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px); border: 1px solid rgba(255,255,255,0.06); border-radius: 16px; padding: 14px 16px; }
body.wp-active .probe-header { border-bottom-color: rgba(255,255,255,0.06); }
body.wp-active .probe-header h3 { color: rgba(255,255,255,0.5); }
body.wp-active .probe-header .status { background: rgba(52,199,89,0.15); color: #4ade80; }
body.wp-active .probe-item .label { color: rgba(255,255,255,0.4); }
body.wp-active .probe-item .value { color: #fff; }
body.wp-active .probe-item .bar-wrap { background: rgba(255,255,255,0.08); }

/* ===== Todo ===== */
.todo { padding: 0; }
.todo-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid rgba(0,0,0,0.04); }
.todo-header h3 { font-size: 11px; font-weight: 600; color: #86868b; letter-spacing: 0.5px; text-transform: uppercase; }
.todo-list { list-style: none; }
.todo-list li { display: flex; align-items: center; gap: 8px; padding: 5px 0; cursor: pointer; border-bottom: 1px solid rgba(0,0,0,0.03); }
.todo-list li.done .text { text-decoration: line-through; color: #aeaeb2; }
.todo-list input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 16px; height: 16px; border: 1.5px solid #c7c7cc; border-radius: 50%; cursor: pointer; transition: all 0.2s; flex-shrink: 0; position: relative; }
.todo-list input[type="checkbox"]:checked { background: #007aff; border-color: #007aff; }
.todo-list input[type="checkbox"]:checked::after { content: ""; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg viewBox='0 0 14 14' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 7l3 3 5-5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat; }
.todo-list .text { flex: 1; font-size: 14px; color: #1d1d1f; }
.todo-list .badge { font-size: 10px; color: #86868b; font-weight: 500; padding: 2px 8px; border-radius: 20px; background: rgba(0,0,0,0.03); }

/* Todo glass when wallpaper active */
body.wp-active .todo { background: rgba(255,255,255,0.06); backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px); border: 1px solid rgba(255,255,255,0.06); border-radius: 16px; padding: 14px 16px; }
body.wp-active .todo-header { border-bottom-color: rgba(255,255,255,0.06); }
body.wp-active .todo-header h3 { color: rgba(255,255,255,0.5); }
body.wp-active .todo-list li { border-bottom-color: rgba(255,255,255,0.04); }
body.wp-active .todo-list li.done .text { color: rgba(255,255,255,0.3); }
body.wp-active .todo-list .text { color: #fff; }
body.wp-active .todo-list input[type="checkbox"] { border-color: rgba(255,255,255,0.3); }
body.wp-active .todo-list .badge { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.5); }

/* ===== Categories (Glass cards) ===== */
.section { margin-bottom: 24px; }
.section-title { font-size: 13px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 10px; color: #86868b; transition: color 0.4s ease; }
#categories { grid-column: 1 / -1; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.card {
  background: #fff;
  border-radius: 14px; padding: 16px 14px;
  text-decoration: none; color: #1d1d1f;
  transition: all 0.25s ease; display: flex; flex-direction: column;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  border: 1px solid transparent;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.02); }
.card .ci { font-size: 22px; margin-bottom: 8px; color: #007aff; }
.card .cn { font-size: 14px; font-weight: 500; transition: color 0.4s ease; }
.card .cd { font-size: 11px; color: #86868b; margin-top: 1px; transition: color 0.4s ease; }

/* Glass cards when wallpaper active */
body.wp-active .section-title { color: rgba(255,255,255,0.5); }
body.wp-active .card {
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(50px);
  -webkit-backdrop-filter: blur(50px);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}
body.wp-active .card:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(0,0,0,0.06); border-color: rgba(255,255,255,0.15); }
body.wp-active .card .ci { color: rgba(255,255,255,0.8); }
body.wp-active .card .cn { color: #fff; }
body.wp-active .card .cd { color: rgba(255,255,255,0.4); }

/* ===== Footer ===== */
.footer { grid-column: 1 / -1; text-align: center; padding: 24px 0 36px; color: #aeaeb2; font-size: 11px; transition: color 0.4s ease; }
body.wp-active .footer { color: rgba(255,255,255,0.25); }

/* ===== Admin (kept opaque for usability) ===== */
.admin-overlay { position: fixed; inset: 0; z-index: 20 !important; background: rgba(0,0,0,0.2); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); display: none; overflow-y: auto; padding: 20px; }
.admin-overlay.show { display: block; }
.admin-panel { max-width: 780px; margin: 24px auto; background: #fff; border-radius: 20px; padding: 28px; position: relative; box-shadow: 0 8px 32px rgba(0,0,0,0.04); }
.admin-panel h2 { font-size: 20px; font-weight: 700; margin-bottom: 20px; color: #1d1d1f; }
.close-btn { position: absolute; top: 18px; right: 22px; background: rgba(0,0,0,0.04); border: none; border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; color: #86868b; font-size: 16px; cursor: pointer; transition: background 0.2s; }
.close-btn:hover { background: rgba(0,0,0,0.08); }
.admin-tabs { display: flex; gap: 4px; margin-bottom: 20px; flex-wrap: wrap; border-bottom: 1px solid rgba(0,0,0,0.04); padding-bottom: 12px; }
.admin-tab { padding: 8px 16px; border-radius: 10px; border: none; background: transparent; color: #86868b; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.admin-tab:hover { background: rgba(0,0,0,0.03); color: #1d1d1f; }
.admin-tab.active { background: rgba(0,122,255,0.06); color: #007aff; }
.admin-section { display: none; }
.admin-section.show { display: block; }
.admin-section h3 { font-size: 15px; font-weight: 600; margin-bottom: 14px; color: #1d1d1f; }
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 12px; color: #86868b; font-weight: 500; margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.3px; }
.form-group input, .form-group select { width: 100%; padding: 10px 14px; background: #f5f5f7; border: none; border-radius: 10px; color: #1d1d1f; font-size: 14px; outline: none; transition: background 0.2s; }
.form-group input:focus { background: #e8e8ed; }
.admin-list { list-style: none; }
.admin-list li { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: #f9f9f9; border-radius: 10px; margin-bottom: 4px; gap: 8px; }
.admin-list li .actions { display: flex; gap: 4px; flex-shrink: 0; }
.admin-list li .actions button { background: transparent; border: none; border-radius: 8px; padding: 5px 10px; color: #007aff; font-size: 12px; font-weight: 500; cursor: pointer; transition: background 0.15s; }
.admin-list li .actions button:hover { background: rgba(0,122,255,0.06); }
.admin-list li .actions button.danger { color: #ff3b30; }
.add-btn { background: transparent; border: 1px dashed rgba(0,0,0,0.1); border-radius: 10px; padding: 10px; color: #007aff; font-size: 13px; font-weight: 500; cursor: pointer; width: 100%; text-align: center; transition: all 0.2s; margin-top: 6px; }
.add-btn:hover { background: rgba(0,122,255,0.04); border-color: #007aff; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }

/* Wallpaper section in admin */
.wp-section { margin-top: 16px; padding-top: 16px; border-top: 1px solid rgba(0,0,0,0.04); }
.wp-section h4 { font-size: 13px; font-weight: 600; margin-bottom: 10px; color: #1d1d1f; }
.wp-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.wp-btn { padding: 8px 16px; border-radius: 10px; border: none; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.wp-btn-bing { background: rgba(0,122,255,0.08); color: #007aff; }
.wp-btn-bing:hover { background: rgba(0,122,255,0.14); }
.wp-btn-none { background: rgba(0,0,0,0.04); color: #86868b; }
.wp-btn-none:hover { background: rgba(0,0,0,0.08); }
.wp-btn-upload { background: rgba(52,199,89,0.08); color: #34c759; }
.wp-btn-upload:hover { background: rgba(52,199,89,0.14); }
.wp-btn.active { box-shadow: 0 0 0 2px currentColor; }
.wp-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; margin-top: 8px; }
.wp-preview img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; cursor: pointer; transition: all 0.2s; border: 2px solid transparent; }
.wp-preview img:hover { transform: scale(1.03); }
.wp-preview img.active { border-color: #007aff; }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; z-index: 30 !important; background: rgba(0,0,0,0.15); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); display: none; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal-box { background: #fff; border-radius: 20px; padding: 24px; width: 440px; max-width: 88vw; box-shadow: 0 8px 32px rgba(0,0,0,0.04); }
.modal-box h3 { font-size: 17px; font-weight: 700; margin-bottom: 16px; color: #1d1d1f; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }
.modal-actions button { padding: 8px 20px; border-radius: 10px; border: none; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.modal-actions .btn-cancel { background: #f5f5f7; color: #86868b; }
.modal-actions .btn-cancel:hover { background: #e8e8ed; }
.modal-actions .btn-save { background: #007aff; color: #fff; }
.modal-actions .btn-save:hover { opacity: 0.85; }

@media (max-width: 640px) {
  .container { grid-template-columns: 1fr; gap: 14px; padding: 12px; }
  .card-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .greeting { font-size: 24px; }
  .search-wrap { flex-wrap: wrap; padding: 6px 10px; gap: 4px; }
  .search-wrap input { width: 100%; padding: 4px 0; font-size: 14px; }
  .login-card { padding: 28px 24px; }
  .probe-grid { grid-template-columns: repeat(3, 1fr); }
  .admin-panel { padding: 20px; margin: 8px; }
}

body.wp-active { background: none !important; }
