:root {
  --primary: #4a7c59;
  --primary-dark: #355a41;
  --accent: #f0a500;
  --bg: #f5f5f0;
  --card: #ffffff;
  --text: #333;
  --muted: #777;
  --border: #ddd;
  --danger: #c0392b;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,.1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }

/* Nav */
nav { background: var(--primary); padding: .8rem 1.5rem; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; box-shadow: 0 2px 4px rgba(0,0,0,.2); }
nav a { color: #fff; text-decoration: none; font-weight: 500; padding: .3rem .6rem; border-radius: var(--radius); transition: background .2s; }
nav a:hover { background: var(--primary-dark); }
.nav-brand a { font-size: 1.2rem; font-weight: 700; }
.nav-links { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Container */
.container { max-width: 1100px; margin: 2rem auto; padding: 0 1rem; }
.page-title { font-size: 1.8rem; margin-bottom: 1.5rem; color: var(--primary-dark); }

/* Cards */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; margin-bottom: 1.5rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
label { display: block; font-weight: 600; margin-bottom: .3rem; }
input[type=text],input[type=email],input[type=password],textarea,select {
  width: 100%; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 1rem; transition: border .2s;
}
input:focus,textarea:focus,select:focus { outline: none; border-color: var(--primary); }
textarea { min-height: 80px; resize: vertical; }
.btn { display: inline-block; padding: .6rem 1.2rem; border: none; border-radius: var(--radius); cursor: pointer; font-size: .95rem; font-weight: 600; text-decoration: none; transition: background .2s, transform .1s; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: .3rem .7rem; font-size: .85rem; }

/* Alerts */
.alert { padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.alert-success { background: #d4edda; color: #155724; }
.alert-error { background: #f8d7da; color: #721c24; }
.alert-info { background: #d1ecf1; color: #0c5460; }

/* Auth pages */
.auth-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); }
.auth-box { background: var(--card); padding: 2.5rem; border-radius: var(--radius); box-shadow: 0 8px 32px rgba(0,0,0,.2); width: 100%; max-width: 420px; }
.auth-box h1 { text-align: center; margin-bottom: 1.5rem; color: var(--primary-dark); }
.auth-logo { text-align: center; font-size: 3rem; margin-bottom: .5rem; }
.auth-box .form-group label { color: var(--text); }

/* Dashboard modules */
.modules-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; margin-top: 1.5rem; }
.module-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 2rem; text-align: center; text-decoration: none; color: var(--text); transition: transform .2s, box-shadow .2s; border-top: 4px solid var(--primary); }
.module-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.module-icon { font-size: 3.5rem; display: block; margin-bottom: .8rem; }
.module-card h2 { color: var(--primary-dark); margin-bottom: .5rem; }
.module-card p { color: var(--muted); font-size: .9rem; }

/* Albums grid */
.albums-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.2rem; }
.album-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; text-decoration: none; color: var(--text); transition: transform .2s; }
.album-card:hover { transform: translateY(-3px); }
.album-cover { width: 100%; height: 160px; object-fit: cover; background: #eee; display: flex; align-items: center; justify-content: center; font-size: 3rem; color: var(--muted); }
.album-cover img { width: 100%; height: 160px; object-fit: cover; }
.album-info { padding: .8rem; }
.album-info h3 { font-size: 1rem; margin-bottom: .2rem; }
.album-info small { color: var(--muted); font-size: .8rem; }

/* Photos grid */
.photos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .8rem; }
.photo-thumb { position: relative; overflow: hidden; border-radius: var(--radius); aspect-ratio: 1; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.photo-thumb:hover img { transform: scale(1.05); }
.photo-thumb a { display: block; height: 100%; }

/* Photo detail */
.photo-detail { display: grid; grid-template-columns: 1fr 360px; gap: 1.5rem; }
.photo-detail img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }
.comments-section h3 { margin-bottom: 1rem; color: var(--primary-dark); }
.comment { border-bottom: 1px solid var(--border); padding: .7rem 0; }
.comment:last-child { border-bottom: none; }
.comment-author { font-weight: 600; color: var(--primary); font-size: .9rem; }
.comment-date { color: var(--muted); font-size: .8rem; margin-left: .5rem; }
.comment-text { margin-top: .3rem; }

/* Discussion */
.messages-list { display: flex; flex-direction: column; gap: .8rem; }
.message { background: var(--card); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.message.reply { margin-left: 2.5rem; border-left: 3px solid var(--primary); }
.message-header { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .4rem; }
.message-author { font-weight: 700; color: var(--primary-dark); }
.message-date { color: var(--muted); font-size: .8rem; }
.message-actions { margin-top: .5rem; }
.reply-form { margin-top: .7rem; display: none; }
.reply-form.open { display: block; }

/* Admin table */
table { width: 100%; border-collapse: collapse; }
th, td { padding: .7rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--bg); font-weight: 700; color: var(--primary-dark); }
tr:hover td { background: #f9f9f7; }

/* Checkbox row */
.notif-row { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.notif-row label { display: flex; align-items: center; gap: .4rem; font-weight: normal; cursor: pointer; }
.notif-row input[type=checkbox] { width: auto; }

/* Upload zone */
.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 2rem; text-align: center; cursor: pointer; transition: border-color .2s; }
.upload-zone:hover, .upload-zone.drag { border-color: var(--primary); background: #f0f7f3; }

footer { text-align: center; padding: 1.5rem; color: var(--muted); font-size: .85rem; margin-top: 2rem; border-top: 1px solid var(--border); }
@media (max-width: 700px) {
  .photo-detail { grid-template-columns: 1fr; }
  .modules-grid { grid-template-columns: 1fr; }
}

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; animation: fadeIn .15s;
}
@keyframes fadeIn { from { opacity:0 } to { opacity:1 } }
.modal-box {
  background: var(--card); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0,0,0,.25);
  width: 100%; max-width: 400px; max-height: 80vh; display: flex; flex-direction: column;
  margin: 1rem;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.2rem; border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; color: var(--primary-dark); }
.modal-close {
  background: none; border: none; font-size: 1.2rem; cursor: pointer;
  color: var(--muted); line-height: 1; padding: .2rem .4rem; border-radius: 4px;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { overflow-y: auto; padding: .8rem 1.2rem; }
.member-row {
  display: flex; align-items: center; gap: .8rem;
  padding: .6rem 0; border-bottom: 1px solid var(--border);
}
.member-row:last-child { border-bottom: none; }
.member-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; flex-shrink: 0;
}
.member-row > div:nth-child(2) { flex: 1; }
.badge-admin {
  background: var(--accent); color: #fff; font-size: .75rem;
  padding: 2px 8px; border-radius: 4px; font-weight: 600; flex-shrink: 0;
}

/* ── Emoji picker ── */
.emoji-btn {
  background: none; border: 1px solid var(--border); border-radius: var(--radius);
  padding: .3rem .6rem; font-size: 1.1rem; cursor: pointer; line-height: 1;
  transition: background .15s;
}
.emoji-btn:hover { background: var(--bg); }
.emoji-picker {
  display: none; position: absolute; z-index: 200;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: .5rem; width: 280px;
}
.emoji-picker.open { display: grid; grid-template-columns: repeat(8,1fr); gap: 2px; }
.emoji-picker button {
  background: none; border: none; font-size: 1.3rem; cursor: pointer;
  padding: .2rem; border-radius: 4px; line-height: 1.2; text-align: center;
}
.emoji-picker button:hover { background: var(--bg); }
.emoji-wrap { position: relative; display: inline-block; }
