/* ----- Variables ----- */
:root {
  --bg-blur: 12px;
  --overlay: rgba(0, 0, 0, 0.4);
  --bg-dark: #1c1c1c;
  --card-bg: #252525;
  --card-border: #333;
  --text: #f5f5f5;
  --text-muted: #888;
  --input-bg: #1a1a1a;
  --input-border: #333;
  --btn-bg: #fff;
  --btn-text: #000;
  --accent: #fff;
  --error: #e55;
}

/* ----- Base ----- */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  overflow-x: hidden;
  background: var(--bg-dark);
}

.hidden {
  display: none !important;
}

/* ----- Screens ----- */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ----- Login ----- */
#login-screen {
  z-index: 10;
}

.login-backdrop {
  position: absolute;
  inset: 0;
  background: url("../backgroundimage.png") center/cover no-repeat;
  filter: blur(var(--bg-blur));
  transform: scale(1.05);
}

#login-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--overlay);
}

.login-card {
  position: relative;
  z-index: 1;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 2.5rem;
  min-width: 320px;
  text-align: center;
}

.login-card h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text);
}

.login-subtitle {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#login-form input {
  padding: 0.75rem 1rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  font-size: 1rem;
  border-radius: 4px;
}

#login-form input::placeholder {
  color: var(--text-muted);
}

#login-form input:focus {
  outline: none;
  border-color: #555;
}

#login-form button {
  padding: 0.75rem 1.5rem;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
}

#login-form button:hover {
  background: #e0e0e0;
}

.login-error {
  margin: 0.75rem 0 0;
  color: var(--error);
  font-size: 0.9rem;
  min-height: 1.2em;
}

/* ----- Dashboard ----- */
#dashboard-screen {
  z-index: 5;
}

.dashboard-backdrop {
  position: absolute;
  inset: 0;
  background: #1a1a1a;
}

#dashboard-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: transparent;
  pointer-events: none;
}

.dashboard-content {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  background: transparent;
}

.dashboard-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  margin-bottom: 1rem;
}

.timezones {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
}

.tz-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 120px;
}

.tz-flag {
  font-size: 1.5rem;
  line-height: 1;
  display: block;
  margin-bottom: 0.25rem;
}

.tz-label {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
}

.tz-time {
  font-size: 2rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.logout-btn {
  margin-top: auto;
  padding: 0.6rem 1rem;
  background: #c62828;
  color: #fff;
  border: none;
  font-size: 0.9rem;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  white-space: nowrap;
  width: 100%;
}

.logout-btn:hover {
  background: #b71c1c;
  color: #fff;
}

/* ----- Dashboard body: left sidebar + main + right sidebar ----- */
.dashboard-body {
  display: flex;
  flex: 1;
  min-height: 0;
  width: 100%;
  min-height: calc(100vh - 1.5rem);
}

.dashboard-sidebar-left {
  width: 240px;
  flex-shrink: 0;
  background: rgba(37, 37, 37, 0.85);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.reminders-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  padding-bottom: 0.5rem;
}

.reminders-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-height: 80px;
  overflow-y: auto;
}

.reminders-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.reminders-list li .reminder-date {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.reminders-list li .reminder-delete {
  align-self: flex-start;
  margin-top: 0.25rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  background: transparent;
  border: 1px solid var(--input-border);
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 3px;
}

.reminders-list li .reminder-delete:hover {
  color: var(--error);
  border-color: var(--error);
}

.reminder-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.reminder-form input {
  padding: 0.5rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 0.8rem;
  border-radius: 3px;
}

.reminder-form input::placeholder {
  color: var(--text-muted);
}

.reminder-form button {
  padding: 0.5rem;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: 3px;
}

.reminder-form button:hover {
  opacity: 0.9;
}

.contacts-section {
  width: 100%;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.contacts-section-title {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
}
.contacts-add-btn {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--card-border);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
}
.contacts-add-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}
.contacts-dropdown {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.contacts-dropdown-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}
.contacts-dropdown-box {
  position: relative;
  width: 100%;
  max-width: 320px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  padding: 1rem;
}
.contacts-dropdown.hidden {
  display: none !important;
}
.contacts-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  min-height: 40px;
  max-height: 200px;
}
.contacts-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.contacts-list li .contact-name { font-weight: 600; color: var(--text); }
.contacts-list li .contact-phone,
.contacts-list li .contact-email { font-size: 0.75rem; color: var(--text-muted); }
.contacts-list li .contact-delete {
  align-self: flex-start;
  margin-top: 0.25rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  background: transparent;
  border: 1px solid var(--input-border);
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 3px;
}
.contacts-list li .contact-delete:hover {
  color: var(--error);
  border-color: var(--error);
}
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.contact-form input {
  padding: 0.5rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  font-size: 0.8rem;
  border-radius: 3px;
}
.contact-form input::placeholder { color: var(--text-muted); }
.contact-form button {
  padding: 0.5rem;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 3px;
}
.contact-form button:hover { background: #e0e0e0; }

.dashboard-main {
  flex: 1;
  min-width: 0;
  padding: 0 1rem;
  position: relative;
  background: transparent;
}
.dashboard-main .dashboard-header,
.dashboard-main .root-view,
.dashboard-main .folder-view {
  position: relative;
  z-index: 1;
}

.dashboard-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: rgba(37, 37, 37, 0.85);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.abroad-users-stat,
.abroad-stat {
  text-align: center;
  margin-bottom: 1rem;
}

.abroad-users-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.abroad-users-count {
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.abroad-reports-section {
  width: 100%;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.abroad-reports-title {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.abroad-reports-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 200px;
  overflow-y: auto;
}

.abroad-report-item {
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.85rem;
}

.abroad-report-item a {
  color: var(--text);
  text-decoration: none;
}

.abroad-report-item a:hover {
  text-decoration: underline;
}

.abroad-report-date {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.abroad-report-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

#dashboard-screen .company-name,
#dashboard-screen .item-card,
#dashboard-screen .btn-add,
#dashboard-screen .item-name,
#dashboard-screen a {
  color: var(--text);
}

/* ----- Main content ----- */

.root-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  width: 100%;
  padding: 0.5rem 0;
}

@media (max-width: 768px) {
  .root-view {
    grid-template-columns: 1fr;
  }
}

.company-section {
  min-width: 0;
  padding: 0 0.5rem;
}

.company-section .company-name {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.toolbar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.btn-add {
  padding: 0.5rem 1rem;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 4px;
}

.btn-add:hover {
  background: rgba(255,255,255,0.25);
}

.items-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
}

/* ----- Cards: folder & link ----- */
.item-card {
  width: 160px;
  min-height: 100px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
}

.item-card:hover {
  border-color: rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.6);
}

.item-card.folder {
  cursor: pointer;
}

.item-card.link a,
.item-card.link .item-link-target {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.item-card .item-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.9;
}

.item-card .item-icon-img {
  width: 2rem;
  height: 2rem;
  object-fit: contain;
}

.item-card .item-icon-folder svg {
  width: 2rem;
  height: 1.75rem;
  display: block;
}

.item-card .item-name {
  font-size: 0.95rem;
  font-weight: 500;
  word-break: break-word;
}

.item-card .item-actions {
  margin-top: auto;
  padding-top: 0.5rem;
  display: flex;
  gap: 0.25rem;
}

.item-card .item-actions button {
  padding: 0.25rem 0.5rem;
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: 2px;
}

.item-card .item-actions button:hover {
  color: var(--text);
  background: rgba(255,255,255,0.1);
}

/* Folder contents view */
.folder-view {
  width: 100%;
}

.folder-view .folder-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.folder-view .folder-title {
  flex: 1;
  min-width: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.folder-view .folder-header-actions {
  display: flex;
  gap: 0.5rem;
}

.folder-view .folder-drop-zone {
  min-height: 280px;
  border: 2px dashed rgba(255,255,255,0.2);
  border-radius: 12px;
  padding: 1rem;
  transition: border-color 0.2s, background 0.2s;
}

.folder-view .folder-drop-zone.dragover {
  border-color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.06);
}

.folder-view .folder-items-inner {
  min-height: 240px;
}

.folder-view .folder-back {
  padding: 0.35rem 0.75rem;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
}

.folder-view .folder-back:hover {
  background: rgba(255,255,255,0.2);
}

.folder-view .folder-title {
  font-size: 1.1rem;
  font-weight: 600;
}

/* ----- Modal ----- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
}

.modal-box {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 1.5rem;
  min-width: 320px;
  max-width: 420px;
  border-radius: 8px;
}

.modal-box h2 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.form-row {
  margin-bottom: 1rem;
}

.form-row label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.form-row input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  font-size: 1rem;
  border-radius: 4px;
}

.form-row input:focus {
  outline: none;
  border-color: #555;
}

.form-row-url {
  display: block;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.btn-cancel {
  padding: 0.5rem 1rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--input-border);
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 4px;
}

.btn-cancel:hover {
  color: var(--text);
}

.btn-submit {
  padding: 0.5rem 1rem;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 4px;
}

.btn-submit:hover {
  background: #e0e0e0;
}

/* Hide URL row when adding folder or editing file link */
.modal-box.form-folder .form-row-url,
.form-row-url.hidden,
.form-row-icon.hidden {
  display: none;
}

.form-row-icon .file-selected-name.visible {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* File drop zone */
.file-drop-zone {
  border: 2px dashed rgba(255,255,255,0.3);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
  border-color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.05);
}

.file-drop-zone #file-drop-text {
  color: var(--text-muted);
  display: block;
}

.file-drop-zone .file-selected-name {
  display: none;
  color: var(--text);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.file-drop-zone .file-selected-name.visible {
  display: block;
}
