/* ================================================================
   Ainur Kayupova — Work Deliverables Portfolio
   Dark elegant theme with purple accents
   ================================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #16161f;
  --bg-card-hover: #1a1a26;
  --bg-input: #1e1e2a;
  --bg-surface: #111118;
  --accent: #6C5CE7;
  --accent-light: #8b7cf7;
  --accent-dim: rgba(108, 92, 231, 0.12);
  --accent-glow: rgba(108, 92, 231, 0.06);
  --text-primary: #e8e8ed;
  --text-secondary: #a0a0b8;
  --text-muted: #6b6b85;
  --text-dim: #3a3a50;
  --border: rgba(108, 92, 231, 0.12);
  --border-hover: rgba(108, 92, 231, 0.3);
  --success: #2ecc71;
  --success-bg: rgba(46, 204, 113, 0.08);
  --danger: #e74c3c;
  --danger-bg: rgba(231, 76, 60, 0.08);
  --warning: #f39c12;
  --warning-bg: rgba(243, 156, 18, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 20px;
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --transition: 0.2s ease;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Layout --- */
.app-container { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 2rem 3rem;
  max-width: 1100px;
}

/* --- Sidebar elements --- */
.sidebar-brand {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}
.sidebar-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.sidebar-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}
.sidebar-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.6rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.88rem;
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-sans);
}
.nav-item:hover { background: var(--accent-dim); color: var(--text-primary); }
.nav-item.active { background: var(--accent-dim); color: var(--accent-light); font-weight: 500; }
.nav-item .nav-icon { font-size: 1.1rem; width: 20px; text-align: center; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
}

/* --- Page Header --- */
.page-header {
  margin-bottom: 2rem;
}
.page-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}
.page-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 4px 24px rgba(108, 92, 231, 0.06);
}
.card + .card { margin-top: 0.75rem; }

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0.8rem;
}
.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}
.card-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* --- Badges --- */
.badge {
  display: inline-block;
  background: var(--accent-dim);
  color: var(--accent-light);
  padding: 0.15rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }

/* --- Stat boxes --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 2rem;
}
.stat-box {
  background: var(--accent-glow);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  padding: 1.2rem;
  text-align: center;
}
.stat-number {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent-light);
  line-height: 1.2;
}
.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.3rem;
}

/* --- Forms --- */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  font-weight: 500;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.6rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  transition: border-color var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
}
.form-textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-dim); }

.form-row { display: flex; gap: 1rem; }
.form-row > * { flex: 1; }

/* File upload drop zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-secondary);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.upload-zone-icon { font-size: 2.5rem; margin-bottom: 0.8rem; }
.upload-zone-text { color: var(--text-secondary); font-size: 0.9rem; }
.upload-zone-hint { color: var(--text-dim); font-size: 0.78rem; margin-top: 0.4rem; }
.upload-zone input[type="file"] { display: none; }

.file-preview-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.8rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 0.8rem;
}
.file-preview-icon { font-size: 1.5rem; }
.file-preview-info { flex: 1; }
.file-preview-name { font-size: 0.88rem; font-weight: 500; }
.file-preview-size { font-size: 0.75rem; color: var(--text-muted); }
.file-preview-remove {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 1.1rem; padding: 4px;
}
.file-preview-remove:hover { color: var(--danger); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.55rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:hover { border-color: var(--border-hover); background: var(--accent-dim); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:disabled:hover { background: transparent; border-color: var(--border); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #5a4bd6; border-color: #5a4bd6; }

.btn-danger { border-color: rgba(231, 76, 60, 0.3); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }

.btn-success { border-color: rgba(46, 204, 113, 0.3); color: var(--success); }
.btn-success:hover { background: var(--success-bg); border-color: var(--success); }

.btn-ghost { border-color: transparent; }
.btn-ghost:hover { border-color: var(--border); background: var(--accent-dim); }

.btn-block { width: 100%; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-lg { padding: 0.7rem 1.6rem; font-size: 0.95rem; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Login --- */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}
.login-box {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
}
.login-brand {
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}
.login-tagline {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}
.login-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}
.login-footer {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 1.5rem;
}
.login-error {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  margin-bottom: 1rem;
  display: none;
}

/* --- Consent Dialog --- */
.consent-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}
.consent-box {
  max-width: 620px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
}
.consent-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1.5rem;
}
.consent-text {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.8;
}
.consent-text ol { padding-left: 1.2rem; }
.consent-text li { margin-bottom: 0.8rem; }
.consent-text strong { color: var(--text-primary); }
.consent-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 1.5rem 0 1rem;
  font-size: 0.88rem;
  cursor: pointer;
}
.consent-check input { accent-color: var(--accent); width: 18px; height: 18px; cursor: pointer; }

/* --- Viewer Gallery --- */
.viewer-header {
  text-align: center;
  padding: 2rem 0 1rem;
}
.viewer-brand {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}
.viewer-tagline {
  color: var(--accent-light);
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.2rem;
}
.viewer-desc {
  color: var(--text-muted);
  font-size: 0.82rem;
}
.viewer-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}
.viewer-footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.72rem;
  padding: 2rem 0 1rem;
}

/* --- Document Preview --- */
.preview-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 1rem;
  overflow: hidden;
}
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.preview-body {
  padding: 1.5rem;
  max-height: 600px;
  overflow-y: auto;
}
.preview-body canvas { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.preview-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.preview-body table th, .preview-body table td {
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--border);
  text-align: left;
}
.preview-body table th {
  background: var(--bg-card);
  font-weight: 500;
  color: var(--text-secondary);
}
.preview-body img { max-width: 100%; height: auto; display: block; }
.preview-html {
  font-family: Georgia, serif;
  line-height: 1.8;
  color: var(--text-secondary);
}
.preview-html h1, .preview-html h2, .preview-html h3 { color: var(--text-primary); margin: 1rem 0 0.5rem; }
.preview-html p { margin-bottom: 0.8rem; }
.preview-html table { margin: 1rem 0; }

.preview-slide {
  background: linear-gradient(135deg, #1e1e3a 0%, #16162b 100%);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  padding: 2rem;
  min-height: 300px;
  margin-bottom: 1rem;
}
.preview-slide-title {
  color: var(--accent-light);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1rem;
}
.preview-slide-body { color: var(--text-secondary); line-height: 1.8; }
.preview-slide-num { color: var(--text-dim); font-size: 0.75rem; margin-top: 1rem; }

.preview-placeholder {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}
.preview-placeholder-icon { font-size: 3rem; margin-bottom: 1rem; }

/* --- Expand/collapse toggle for viewer --- */
.doc-expand-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 0.8rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.8rem;
  color: var(--accent-light);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}
.doc-expand-btn:hover { background: var(--accent-dim); border-color: var(--accent); }

/* --- Search bar --- */
.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 1.5rem;
}
.search-bar .form-input { flex: 1; }

/* --- Tags --- */
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 0.4rem; }
.tag {
  background: var(--bg-secondary);
  color: var(--text-muted);
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
}

/* --- Help section --- */
.help-card {
  background: var(--accent-glow);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  margin-bottom: 0.8rem;
}
.help-card strong { color: var(--text-primary); }
.help-card p { color: var(--text-secondary); font-size: 0.88rem; margin-top: 0.3rem; }

.faq-item { border-bottom: 1px solid var(--border); }
.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1rem 0;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.faq-question:hover { color: var(--accent-light); }
.faq-answer {
  display: none;
  padding: 0 0 1rem;
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.7;
}
.faq-item.open .faq-answer { display: block; }
.faq-toggle { transition: transform var(--transition); font-size: 0.9rem; }
.faq-item.open .faq-toggle { transform: rotate(180deg); }

/* --- Alerts --- */
.alert {
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.alert-info { background: rgba(108, 92, 231, 0.08); color: var(--accent-light); border: 1px solid var(--accent-dim); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(46,204,113,0.2); }
.alert-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(231,76,60,0.2); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(243,156,18,0.2); }

/* --- Loading spinner --- */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Confirmation dialog --- */
.confirm-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.confirm-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 400px;
  width: 90%;
}
.confirm-title { font-weight: 600; margin-bottom: 0.8rem; }
.confirm-message { font-size: 0.88rem; color: var(--text-secondary); margin-bottom: 1.5rem; }
.confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* --- Content Protection (viewer mode) --- */
.protected * {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}
.protected img {
  -webkit-user-drag: none !important;
  user-drag: none !important;
  pointer-events: none !important;
}
.protected ::selection { background: transparent !important; }
.protected ::-moz-selection { background: transparent !important; }

/* Watermark */
.watermark {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-35deg);
  font-size: 3rem;
  font-weight: 700;
  color: rgba(108, 92, 231, 0.035);
  white-space: nowrap;
  pointer-events: none;
  z-index: 9999;
  letter-spacing: 0.1em;
}

/* Print protection */
@media print {
  body { display: none !important; visibility: hidden !important; }
  body::after {
    content: "Printing is not permitted for this document.";
    display: block; visibility: visible;
    font-size: 24px; text-align: center; padding: 60px;
  }
}

/* --- Toast notifications --- */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1.2rem;
  font-size: 0.85rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  animation: slideIn 0.3s ease;
  max-width: 360px;
}
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-info { border-left: 3px solid var(--accent); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* --- Responsive --- */
@media (max-width: 768px) {
  .sidebar { width: 100%; position: relative; border-right: none; border-bottom: 1px solid var(--border); }
  .main-content { margin-left: 0; padding: 1.5rem; }
  .app-container { flex-direction: column; }
  .form-row { flex-direction: column; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- Hidden utility --- */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
