/* =========================================================
   smallscreen_base.css  (<= 900px)
   Eesmärk: kompaktne, selge mobiilivaade
   ========================================================= */

/* ========== 1) BASE RESET / GLOBAL ========== */
body {
  font-family: Arial, Helvetica, sans-serif; /* mandatory */
  font-size: small;
  margin: 0;
}

.hidden { display: none; }
.error { color: red; }

.field-error input,
.field-error select,
.field-error textarea {
  border: 1px solid red;
  color: red;
}

/* Buttons (kasutad nii headeris, vormides kui admin linkidel) */
a.btn {
  display: inline-block;
  text-align: center;
  padding: 2% 2%;
  text-transform: uppercase;
  font-weight: 400;
  border: 1px solid #d9d9d9;
  background: none;
  color: #515151;
  font-family: inherit;
  transition: all 0.3s ease;
  margin-right: 5px;
  text-decoration: none;
}

a.btn:hover {
  border: 1px solid #aedaa6;
  color: #aedaa6;
  cursor: pointer;
}

/* ========== 2) WARNING TEXT ========== */
#yellow-warning-text,
.yellow-warning-text,
#green-warning-text,
.green-warning-text,
#red-warning-text,
.red-warning-text {
  padding: 5px;
  margin-top: 10px;
  text-align: center;
  vertical-align: middle;
  font-weight: bold;
  color: #313131;
  text-transform: uppercase;
  font-size: 12px;
  text-decoration: none;
}

#yellow-warning-text,
.yellow-warning-text {
  background: #ffdc00;
}

#green-warning-text,
.green-warning-text {
  background: #30cc71;
}

#red-warning-text,
.red-warning-text {
  background: red;
}

.warning-fullwidth{
  flex: 0 0 98%;      /* ⬅️ võtab TERVE rea */
  width: 98%;        /* kindluse mõttes */
  box-sizing: border-box;

  margin: 6px 10px 0 10px;
  padding: 2px 14px;

  border-radius: 4px;
  text-align: center;
}

/* ========== 3) HEADER / NAV ========== */
#header-logo {
  padding: 10px 0px 5px 0px; /* mandatory */
  text-align: center;        /* mandatory */
  background: #CC0000;
  color: black;
  min-height: 20px;
}

#hide_logo2 { display: none; }

.flex-row {
  display: flex;
  flex-direction: row;
}

#header-navbar {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  background-color: #181818;
  transition: all 0.3s;
}

#header-navbar .flex-row {
  align-items: center;
}

#header-navbar a {
  color: white;
  padding: 10px 16px;
  text-decoration: none;
  text-align: center;
}

#header-navbar a:hover {
  background-color: #D5D6D5;
  color: black;
}

/* hamburger mobiilis nähtav */
#hamburger-button{
  display: inline-block;
  color: white;
  padding: 10px 14px;
  text-decoration: none;
  font-size: 22px;
}

/* Mobiilis peidame parempoolse kasutaja dropdowni nupu + dropdowni */
a.btn.username-btn,
#user-dropdown{
  display: none !important;
}

/* ...AGA vasakus menüüs lubame username real nähtav olla */
#left-sidebar a.btn.username-btn.sidebar-username{
  display: inline-flex !important;
}

/* ========== 4) SIDEBAR (hamburger menüü) ========== */
#left-sidebar {
  background-color: #4c5055; /* mandatory */
  display: none;             /* JS toggle */
  text-align: center;
}

/* üldlink sidebaris */
#left-sidebar a {
  color: white;
  padding: 12px 16px;
  text-decoration: none;
  font-size: 15px;     /* mobiilis mõistlik */
  display: block;
  border-top: 1px solid #D5D6D5;
}

#left-sidebar label {
  color: white;
  font-size: 15px;
}

#left-sidebar a:hover {
  background-color: #D5D6D5;
  color: black;
  font-weight: bold;
}

#selected a { font-weight: bold; }

/* Sektsioonide struktuur */
#left-sidebar .menu-section { padding: 0; }

/* Sektsiooni pealkiri (Kasutaja / Otsingud) */
#left-sidebar .menu-section-title{
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 10px 16px;
  margin: 0;

  font-weight: 800;
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: 0.6px;

  color: white;
  background: rgba(0, 0, 0, 0.18);
  border-top: 1px solid rgba(255,255,255,0.18);
  border-bottom: 1px solid rgba(255,255,255,0.18);
}

#left-sidebar .menu-section-title i{
  width: 18px;
  text-align: center;
}

/* Kasutaja sektsioon: õrn eristus */
#left-sidebar .user-section{
  background: rgba(204, 0, 0, 0.10);
  border-bottom: 1px solid rgba(255,255,255,0.18);
}

/* Ikoonide joondus sidebar linkidel */
#left-sidebar a i{
  width: 18px;
  margin-right: 10px;
  text-align: center;
}

/* Sidebaris username rida (informatiivne) */
#left-sidebar a.sidebar-username{
  margin: 8px 12px 10px 12px;
  width: auto;
  max-width: calc(100% - 24px);

  border-color: rgba(255,255,255,0.35);
  color: white;
}

#left-sidebar a.sidebar-username:hover{
  background-color: rgba(255,255,255,0.08);
  color: white;
}

/* username nupu sees olev tekst ellipsiseks */
#left-sidebar a.sidebar-username .username-text{
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========== 5) MAIN / LAYOUT ========== */
#main {
  background-color: white;
  padding: 10px;
  margin: 0 auto;
  overflow-x: auto;
}

#sidebar-toggle-container { display: none; } /* desktop feature off */

#main-content-area {
  flex: 1; /* this allows it to take the remaining space */
}

#main-content-area canvas {
  width: 100% !important;
  height: auto !important;
}

.chart-container {
  min-height: 300px;
  margin-bottom: 30px;
}

/* ========== 6) SPINNER ========== */
.spinner {
  margin: 0 auto;
  width: 40px;
  height: 40px;
  border: 5px solid #ccc;
  border-top: 5px solid #CC0000;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ========== 7) FOOTER ========== */
.footer {
  padding: 10px;
  text-align: center;
  background: #181818;
  margin: 10px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.16), 0 2px 10px rgba(0,0,0,0.12);
  transition: all 0.3s;
}

.footer:hover {
  box-shadow: 0 8px 17px rgba(0,0,0,0.2), 0 6px 20px rgba(0,0,0,0.19);
}

.footer .row {
  width: 100%;
  margin: 1% 0;
  padding: 0.6% 0;
  color: gray;
  font-size: 0.8em;
}

.footer .row a {
  text-decoration: none;
  color: gray;
  transition: 0.5s;
}

.footer .row a:hover { color: #fff; }

.footer .row a i {
  font-size: 2em;
  margin: 0 1%;
}

/* ========== 8) PAGINATION ========== */
.pagination {
  text-align: center;
  padding: 10px;
  margin-top: 20px;
  font-size: 14px;
}

.pagination a {
  margin: 0 5px;
  padding: 5px 10px;
  border: 1px solid #d9d9d9;
  text-decoration: none;
  color: #515151;
  transition: all 0.3s ease;
}

.pagination a:hover {
  border: 1px solid #aedaa6;
  color: #aedaa6;
}

.pagination .page-current {
  font-weight: bold;
  margin: 0 10px;
}

/* ========== 9) ROUND BUTTON (admin add) ========== */
.round-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background-color: red;
  color: white;
  border: none;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  font-size: 28px;
  text-decoration: none;
  z-index: 1000;
  transition: background-color 0.3s ease;
}

.round-button:hover { background-color: #CC0000; }

/* ========== 10) KASUTUSJUHEND ICON LINK ========== */
.kasutusjuhend-container { margin-left: auto; }

.kasutusjuhend-link {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.kasutusjuhend-text {
  font-size: 12px;
  color: #727272;
  font-weight: bold;
}

.pdf-icon { color: #d32f2f; font-size: 20px; }
.puudub-icon { color: #727272; font-size: 20px; }

/* ========== 11) CARDS (mobiilis kitsam) ========== */
.card {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  margin: 14px auto;
  width: 96%;
  background: white;
  box-shadow: 0 2px 5px rgba(0,0,0,0.10), 0 2px 10px rgba(0,0,0,0.08);
  transition: all 0.3s;
}

.card:hover {
  box-shadow: 0 8px 17px rgba(0,0,0,0.12), 0 6px 20px rgba(0,0,0,0.10);
}

.card nav {
  display: flex;
  align-items: center;
  width: 100%;
  color: #727272;
  text-transform: uppercase;
  padding: 14px 0 8px 4px;
  border-bottom: 2px solid #efefef;
  font-size: 12px;
}

/* "Tagasi seadmete nimekirja" link vasakule */
.card nav a.header{
  flex: 1;
  min-width: 0;
}

/* Südamed paremale */
.card nav > a:not(.header){
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.card nav a { text-decoration: none; color: #727272; }

.card .photo {
  padding: 16px;
  width: 100%;
  text-align: center;
}

.card .photo img {
  height: auto;
  max-width: 100%;
  max-height: 300px;
}

.card .description {
  padding: 10px 14px 14px 14px;
  width: 100%;
  border-left: 2px solid #efefef;
}

.card .whole_width {
  width: 100%;
  box-sizing: border-box;
  border-top: 2px solid #efefef;
}

.card .description h2,
.card .description h3,
.card .description h4,
.card .description h5,
.card .description p { margin: 0; }

.card .description h2 {
  color: #515151;
  text-transform: uppercase;
  font-weight: 500;
  font-size: 18px;
}

.card .description h3 {
  color: #515151;
  font-size: 15px;
  font-weight: 300;
  padding-top: 6px;
}

.card .description p {
  font-size: 12px;
  line-height: 18px;
  color: #727272;
  padding: 12px 0;
}

/* ========== 12) SEADMETE LIST (mobiilis kompaktne) ========== */
/* Eesmärk: pilt vasakul, info paremal, lisainfo all, väga kompaktne */

.list-row{
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;            /* header + bottom lähevad alla */
  align-items: flex-start;

  width: 96%;
  margin: 8px auto;
  background: white;
  box-shadow: none;
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 8px;
  overflow: hidden;
}

/* header täislaiuses */
.list-row .header{
  width: 100%;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(0,0,0,0.10);
  background: rgba(0,0,0,0.03);
  box-sizing: border-box;
}

/* pealkiri kompaktseks */
.list-row .header a{
  padding: 0;
  margin: 0;
  font-size: 14px;
  line-height: 18px;
  color: #515151;
  text-decoration: none;
}

/* südamed väiksemaks */
.heart{
  height: 18px;
  width: 18px;
  float: none;
  margin: 00;
  vertical-align: middle;
  cursor: pointer;
}

/* pilt vasakule (fix) */
.list-row .picture{
  flex: 0 0 92px;
  width: 92px;
  min-width: 92px;

  margin: 0;
  text-align: left;
  float: none;
  box-sizing: border-box;
}

.list-row .picture img{
  width: 76px;
  height: 76px;
  object-fit: cover;
  border-radius: 4px;
  margin: 0;
  max-width: none;
  max-height: none;
}

/* joonda pilt ja tekst samale algusjoonele */
.list-row .picture{ padding: 8px 8px 0 10px;}
.list-row .left{ padding-top: 0; }


.list-row .left{
  box-sizing: border-box;
}

.list-row .content{
  display: contents;
}

/* eemalda mullid ja tee üheks veeruks */
.list-row .flex-container{ display: block; }

.list-row .left,
.list-row .right{
  background: transparent;
  box-shadow: none;
  margin: 0;
  padding: 0;
}

/* väga kompaktne: peida parempoolne info plokk */
.list-row .right{ display: none; }

.list-row{
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
}

/* pilt vasakul */
.list-row .picture{
  flex: 0 0 72px;
  padding: 8px 8px 0 10px;
  box-sizing: border-box;
}

/* vasak info pildi kõrval */
.list-row .left{
  flex: 1;
  min-width: 0;
  padding: 8px 8px 0px 2px;
  box-sizing: border-box;
  font-size: 12px;
}


/* lisainfo alla täislaiuses */
.list-row .bottom{
  flex: 0 0 100%;
  width: 100%;

  padding: 0px 10px 8px 10px;
  margin-top: 0;
  border-top: 1px solid rgba(0,0,0,0.08);

  display: flex;
  align-items: center;
}
.list-row .bottom > div:first-child{
  flex: 1;
}
.list-row .bottom > div:last-child{
  margin-left: auto;
}


/* Lisainfo tekst max 2 rida */
.list-row .bottom a{
  font-size: 12px;
  line-height: 12px;

  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}



/* Seadmete listi info tekst – tagasi halliks */
.list-row .left a,
.list-row .bottom a{
  color: #6f6f6f;
}

/* admin "Muuda" nupp väikseks */
.list-row .bottom .btn{
  width: auto;
  padding: 6px 10px;
  font-size: 12px;
  margin-right: 0;
}

/* ========== 13) TABLE (mobiilis) ========== */
#tööde-tabel {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  line-height: 18px;
  color: #727272;
}

#tööde-tabel td,
#tööde-tabel th {
  border: 1px solid #ddd;
  padding: 6px;
}

#tööde-tabel tr:nth-child(even) { background-color: #f2f2f2; }
#tööde-tabel tr:hover { background-color: #ddd; }

#tööde-tabel th {
  text-align: center;
  background-color: #181818;
  color: white;
  text-transform: uppercase;
  font-weight: 700;
}

#tööde-tabel a {
  text-decoration: none;
  color: #515151;
  transition: 0.5s;
}

#tööde-tabel button,
#tööde-tabel #button {
  font-size: 13px;
  outline: 0;
  border: 1px solid #d9d9d9;
  background: none;
  padding: 4px;
  color: #515151;
  text-transform: uppercase;
  width: 75px;
  font-family: inherit;
  transition: all 0.3s ease;
  font-weight: 500;
  text-align: center;
}

#tööde-tabel button:hover,
#tööde-tabel #button:hover {
  border: 1px solid #aedaa6;
  color: #aedaa6;
  cursor: pointer;
}


/* Header: nimi vasakul, südamed paremal */
.list-row .header{
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

/* Nimi: võib võtta kogu ülejäänud ruumi */
.list-row .header > a:first-child{
  flex: 1;
  min-width: 0;
}

/* Südamed: lükka paremale */
.list-row .header > a:nth-child(2){
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 0;     /* et ei lisaks suurt paddingut */
}

/* Südame ikoonid ühte ritta */
.list-row .header .heart{
  width: 18px;
  height: 18px;
  margin: 0;
  vertical-align: middle;
}



/* 6) Lisainfo alati 100% ja pildi alla */
.list-row .bottom{
  flex: 0 0 100%;
  width: 100%;

  padding: 6px 10px 8px 10px;
  margin-top: 4px;
  border-top: 1px solid rgba(0,0,0,0.08);
  box-sizing: border-box;

  display: flex;              /* et “Muuda” saaks paremale */
  align-items: center;
  gap: 10px;
}

/* Lisainfo tekst võtab ruumi, nupp lükatakse paremale */
.list-row .bottom > div:first-child{
  flex: 1;
  min-width: 0;
}

/* Muuda nupp paremale (sinu inline-style margin-left:auto toimib ka, see on lisakaitse) */
.list-row .bottom > div:last-child{
  margin-left: auto;
}



.card nav svg.arrow {
  float: left;
  height: 15px;
  width: 15px;
  margin-right: 0;
}

.card nav a.header{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1;
}

.card nav svg.arrow{
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}


/* =========================================================
   FORMS – mobile-friendly + matches base.css look
   ========================================================= */

/* Üldine vormi “typography” ja spacing */
form{
  color: #515151;
}

label{
  display: block;
  margin: 10px 0 6px;
  font-weight: 600;
  font-size: 14px;
  color: #515151;
}

/* Kõik sisendid ühtseks */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="date"],
input[type="time"],
input[type="tel"],
input[type="url"],
select,
textarea{
  width: 100%;
  box-sizing: border-box;

  font-family: inherit;
  font-size: 16px;            /* iOS zoom fix */
  line-height: 1.2;

  padding: 10px 12px;
  min-height: 44px;           /* thumb-friendly */
  border-radius: 4px;

  border: 1px solid #d9d9d9;
  background: #fff;
  color: #515151;

  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}


/* Textarea käitumine */
textarea{
  min-height: 110px;
  resize: vertical;
}

/* Focus sama “aedaa6” loogikaga */
input:focus,
select:focus,
textarea:focus{
  border-color: #aedaa6;
  box-shadow: 0 0 0 3px rgba(174, 218, 166, 0.35);
}

/* Placeholder natuke pehmem */
::placeholder{
  color: rgba(81, 81, 81, 0.55);
}

/* Checkbox / radio – jäta normaalseks, aga joonda */
input[type="checkbox"],
input[type="radio"]{
  transform: scale(1.15);
  margin-right: 8px;
}

/* Formi read/vahed (nt sinu .filter-form) */
.filter-form,
.form,
.default-form,
form .form-row{
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Kui sul on forms sees <p> wrapperid (Django default) */
form p{
  margin: 0 0 10px;
}

/* Django helptext */
.helptext{
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #727272;
}

/* Veateated ja errorlist */
.errorlist{
  list-style: none;
  padding: 0;
  margin: 6px 0 10px;
  color: #b00020;
  font-size: 13px;
}

/* Sinu olemasolev .field-error jääb tööle, aga teeme veel selgemaks */
.field-error input,
.field-error select,
.field-error textarea{
  border-color: #b00020;
  box-shadow: 0 0 0 3px rgba(176, 0, 32, 0.15);
}

/* Nupud: ühtlusta base.css “btn” tunnetusega, mobiilis veidi suurem */
button,
input[type="submit"],
input[type="button"],
a.btn{
  min-height: 10px;
  border-radius: 2px;
}

/* Kui sul on <button class="btn ...">, siis see ühtlustab */
button.btn,
input.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 10px 14px;
  border: 1px solid #d9d9d9;
  background: none;
  color: #515151;
  font-family: inherit;
  text-transform: uppercase;
  font-weight: 500;
  transition: all .2s ease;
}

/* Hover/active sama mis base.css */
button.btn:hover,
input.btn:hover,
input[type="submit"]:hover,
button:hover{
  border-color: #aedaa6;
  color: #aedaa6;
  cursor: pointer;
}

/* Väiksed selecti nooled jms – parem “native” tunne */
select{
  appearance: auto;
}

/* Kui form on kaardi sees ja tundub “kitsas”, siis korrigeeri */
#main form{
  max-width: 100%;
}

/* =========================================================
   FORCE UNIFIED BUTTON STYLE (desktop + mobile)
   ========================================================= */

button,
input[type="submit"],
input[type="button"],
.btn,
.btn-outline-primary,
.btn-primary{
  background: none !important;
  color: #515151 !important;
  border: 1px solid #d9d9d9 !important;

  font-family: inherit;
  font-weight: 500;
  text-transform: uppercase;

  border-radius: 6px;
  padding: 8px 14px;
  min-height: 40px;

  box-shadow: none !important;
}


/* Hover – sama roheline nagu mujal */
button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
.btn:hover,
.btn-outline-primary:hover,
.btn-primary:hover{
  border-color: #aedaa6 !important;
  color: #aedaa6 !important;
  background: none !important;
  cursor: pointer;
}

.filter-btn {
  color: #fff !important;
  border-color: #fff;
}

/* Focus – viisakas, mitte sinine */
button:focus,
input:focus,
.btn:focus{
  outline: none;
  box-shadow: 0 0 0 3px rgba(174, 218, 166, 0.35) !important;
}

/* Date/Time kipuvad overflowima – tee neile eraldi fix */
input[type="date"],
input[type="time"]{
  display: block;
  max-width: 92%;
  min-width: 0;
  box-sizing: border-box;
}


/* ===== FIX Chart.js canvas sizing on mobile ===== */
/* Ära lase globaalne "height:auto" Chart.js-i lõhkuda */
#main-content-area .card_chart canvas{
  height: 260px !important;   /* vali 240–360px, mis sulle sobib */
  width: 100% !important;
  display: block;
}

/* Ja containerile kindel raam */
#main-content-area .card_chart{
  width: 96% !important;
  max-width: 100% !important;
  box-sizing: border-box;
  overflow: hidden;
}

#tööde-tabel .col-aeg {
  min-width: 60px;
  white-space: nowrap;
}

#tööde-tabel .col-info {
  min-width: 150px;
  white-space: nowrap;
}

#tööde-tabel .col-hinnang {
  min-width: 80px;
  white-space: nowrap;
}