/* =========================================================
   KassaX — main.css (Modern Premium Light)
   - Täysi korvaava tiedosto
   - Pehmeä kontrasti, modernit kortit, hover/anim efektejä
   - Yhteensopiva sun nykyisten id/luokkien kanssa
   ========================================================= */

/* ---------- Design tokens ---------- */
:root{
  /* Base */
  --bg-0:#f6f8fc;
  --bg-1:#eef3f9;

  --card:#ffffff;
  --card-2:#f8fafc;

  --text:#0f172a;          /* slate-900 */
  --muted:#475569;         /* slate-600 */
  --muted-2:#64748b;       /* slate-500 */

  --border: rgba(15,23,42,.10);
  --border-2: rgba(15,23,42,.16);

  --shadow-sm: 0 10px 22px rgba(2,6,23,.08);
  --shadow-md: 0 16px 40px rgba(2,6,23,.10);
  --shadow-lg: 0 28px 70px rgba(2,6,23,.12);

  --radius: 18px;
  --radius-md: 14px;
  --radius-sm: 12px;

  /* Accent (hillitty premium-sävy) */
  --accent:#3b82f6;        /* blue */
  --accent-soft: rgba(59,130,246,.14);
  --focus: 0 0 0 3px rgba(148,163,184,.40);

  /* Sidebar */
  --sidebar-w: 270px;

  /* Motion */
  --t: 160ms;
  --e: cubic-bezier(.2,.9,.2,1);
}

/* ---------- Global reset ---------- */
*{ box-sizing:border-box; }

html{
  background: var(--bg-0);
  color: var(--text);
  font-family: system-ui,-apple-system,"Segoe UI",Roboto,Arial,"Trebuchet MS",sans-serif;
  font-size:14px;
  -webkit-text-size-adjust:100%;
  text-rendering: optimizeLegibility;
}

html,body{
  margin:0;
  padding:0;
  min-height:100%;
}

img{ max-width:100%; height:auto; display:block; }

p{ margin:10px 0; padding:0; }

ul{ list-style-type:square; }

a:link, a:visited{
  color: var(--text);
  text-decoration:none;
}
a:hover{
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- App background ---------- */
#main{
  min-height:100vh;
  width:100%;
  background:
    radial-gradient(900px 450px at 18% 0%, rgba(2,6,23,.06), transparent 56%),
    radial-gradient(900px 520px at 92% 6%, rgba(2,6,23,.05), transparent 58%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 100%);
}

#content_wrapper{
  width:100%;
  min-height:100vh;
}

/* ---------- Sidebar (premium) ---------- */
#sidebar{
  position: fixed;
  top:0; left:0;
  width: var(--sidebar-w);
  height: 100vh;
  padding: 14px 12px;
  overflow-y:auto;
  z-index: 60;

  background:
    radial-gradient(1200px 700px at 10% 10%, rgba(2,6,23,.06), transparent 55%),
    linear-gradient(180deg, #ffffff 0%, #f1f5fb 100%);
  border-right: 1px solid var(--border);
  box-shadow: 12px 0 38px rgba(2,6,23,.08);

  font-size:12px;
  text-align:left;
}

/* Sidebar list */
#sidebar ul{
  list-style:none;
  margin: 14px 0 0;
  padding:0;
}
#sidebar li{ margin: 6px 0; }

/* Sidebar link: pill + subtle glow on hover */
#sidebar ul li a:link,
#sidebar ul li a:visited{
  color: var(--text);
  display:flex;
  align-items:center;
  gap:10px;
  width:100%;
  padding: 10px 12px;
  border-radius: 14px;

  background: rgba(15,23,42,.03);
  border: 1px solid rgba(15,23,42,.05);

  transition: transform var(--t) var(--e), background var(--t) var(--e), border-color var(--t) var(--e), box-shadow var(--t) var(--e);
}

#sidebar ul li a:hover{
  transform: translateX(2px);
  background: rgba(59,130,246,.08);
  border-color: rgba(59,130,246,.18);
  box-shadow: 0 10px 22px rgba(2,6,23,.10);
  text-decoration:none;
}

/* ---------- Content area ---------- */
#content{
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  padding: 16px;
  color: var(--text);
}

/* Header divider subtle */
#header{
  margin-bottom: 12px;
}
#header::after{
  content:"";
  display:block;
  margin-top: 12px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(2,6,23,.10), transparent);
}

/* ---------- Blocks / Cards ---------- */
/* tärkeää: ei inline-block => ei päällekkäisyyksiä */
.block,
.box{
  width:100%;
  display:block;
  margin: 12px 0;
  padding: 14px;

  background:
    radial-gradient(900px 220px at 22% 0%, rgba(2,6,23,.04), transparent 60%),
    linear-gradient(180deg, #ffffff 0%, #f6f8fb 100%);

  border: 1px solid rgba(148,163,184,.40);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);

  position: relative;
  overflow:hidden;

  transition: transform var(--t) var(--e), box-shadow var(--t) var(--e), border-color var(--t) var(--e);
}

/* Premium highlight line */
.block::before,
.box::before{
  content:"";
  position:absolute;
  top:0; left:0; right:0;
  height:1px;
  background: linear-gradient(90deg, transparent, rgba(2,6,23,.12), transparent);
}

/* Hover “lift” effect */
.block:hover,
.box:hover{
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: rgba(59,130,246,.22);
}

/* Danger box */
.danger{
  margin: 12px 0;
  padding: 12px;
  border-radius: var(--radius);
  background: #fff1f2;
  border: 1px solid #fecdd3;
  box-shadow: 0 12px 30px rgba(190,18,60,.10);
}

/* ---------- Loading ---------- */
#loading{
  z-index:999999;
  display:none;
  position:fixed;
  top:40%;
  left:50%;
  transform: translateX(-50%);
  border-radius: 16px;
  text-align:center;

  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 16px 18px;
}

/* ---------- Tools / layout helpers ---------- */
.tools form{ display:inline-block; }

.toolbox{
  width:100%;
  margin: 10px 0;
  display:block;
}

.toolbox table{
  width:auto !important;
  display:inline-block;
  margin: 8px 10px 0 0 !important;
  vertical-align: top;
}

.tools input[type="text"]{
  min-width: 260px;
  margin-left: 10px;
}

td .long{ width:99%; }
td .short{ width:80px; }

/* ---------- Inputs ---------- */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
select,
textarea{
  max-width:100%;
  background: #f8fafc;
  color: var(--text);
  border: 1px solid rgba(148,163,184,.70);
  border-radius: 14px;
  padding: 10px 12px;
  outline:none;

  transition: box-shadow var(--t) var(--e), border-color var(--t) var(--e), background var(--t) var(--e), transform var(--t) var(--e);
}

textarea{ min-height: 90px; }

input::placeholder,
textarea::placeholder{
  color: rgba(82,96,109,.65);
}

input:focus,
select:focus,
textarea:focus{
  background: #ffffff;
  border-color: rgba(59,130,246,.35);
  box-shadow: var(--focus);
}

input:active{
  transform: translateY(0);
}

/* ---------- Buttons ---------- */
.button,
.page-button{
  appearance:none;
  border: 1px solid rgba(148,163,184,.70);
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  color: var(--text) !important;

  padding: 9px 12px;
  border-radius: 999px;

  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;

  cursor:pointer;
  text-decoration:none !important;

  box-shadow: 0 10px 22px rgba(2,6,23,.10);
  transition: transform var(--t) var(--e), box-shadow var(--t) var(--e), border-color var(--t) var(--e), background var(--t) var(--e);
}

.button:hover,
.page-button:hover{
  transform: translateY(-1px);
  border-color: rgba(59,130,246,.28);
  box-shadow: 0 14px 30px rgba(2,6,23,.12);
  background: linear-gradient(180deg, #ffffff 0%, #e9eef6 100%);
}

.button:active,
.page-button:active{
  transform: translateY(0) scale(.98);
  box-shadow: 0 10px 20px rgba(2,6,23,.12);
}

.page-button{
  padding: 7px 10px;
  color: var(--muted) !important;
}

.page-button-big{ transform: scale(1.12); }

.small{
  float:right;
  width:16px;
  padding:2px;
  margin:2px;
}

/* ---------- Tables (modern, not “too black”) ---------- */
.borders{
  width:100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 12px 0;

  border: 1px solid rgba(148,163,184,.40);
  border-radius: var(--radius);
  overflow:hidden;

  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.borders th,
.borders td{
  padding: 10px 10px;
  font-size: 13px;
  vertical-align: middle;
  border-bottom: 1px solid rgba(15,23,42,.08);
}

/* Premium slate header (NOT pure black) */
.borders th{
  text-align:left;
  font-weight: 900;
  letter-spacing: .2px;
  color:#f8fafc;
  background:
    radial-gradient(900px 240px at 20% 0%, rgba(255,255,255,.10), transparent 60%),
    linear-gradient(180deg, #334155 0%, #1f2937 100%);
}

.borders th a{ color:#f8fafc; }

.borders tr:nth-child(odd) td{ background:#f8fafc; }
.borders tr:hover td{ background:#e9eef6; }
.borders tr:last-child td{ border-bottom:none; }

/* Make table fields look integrated */
.borders input[type="text"],
.borders select,
.borders textarea{
  background:#ffffff;
  border: 1px solid rgba(15,23,42,.16);
  border-radius: 12px;
  padding: 9px 10px;
}

/* ---------- Misc ---------- */
hr{
  border:none;
  border-top: 1px solid rgba(148,163,184,.35);
  margin: 12px 0;
}

#footer{
  clear:both;
  text-align:center;
  margin:18px 0;
  color: var(--muted);
}

/* ---------- Customer list modal ---------- */
#customerList{
  position: fixed;
  left:50%;
  top:50%;
  width: min(620px, calc(100% - 24px));
  height: 360px;
  transform: translate(-50%, -50%);
  overflow:auto;
  display:none;

  background: #ffffff;
  border: 1px solid rgba(148,163,184,.45);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  z-index: 99998;
}

/* ---------- Error box ---------- */
#errorBox{
  position: fixed;
  left:50%;
  top:50%;
  width: min(380px, calc(100% - 24px));
  height: 230px;
  transform: translate(-50%, -50%);
  display:block;

  background: #ffffff;
  border: 1px solid rgba(148,163,184,.45);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  z-index: 99998;
}

#errorBox_header{
  padding: 10px 12px;
  margin:0;
  color:#ffffff;
  font-weight: 900;
  text-align:center;
  border-bottom: 1px solid rgba(0,0,0,.06);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;

  background:
    radial-gradient(900px 220px at 20% 0%, rgba(255,255,255,.12), transparent 60%),
    linear-gradient(180deg, #475569 0%, #1f2937 100%);
}

/* ---------- Login area ---------- */
#login_area{
  width: min(380px, calc(100% - 24px));
  position: fixed;
  left:50%;
  top:50%;
  transform: translate(-50%, -50%);

  background: #ffffff;
  border: 1px solid rgba(148,163,184,.45);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);

  padding: 18px;
  z-index: 99998;
}

/* ---------- Scroll panels ---------- */
#package_products,
.search{
  border: 1px solid rgba(148,163,184,.35);
  border-radius: 14px;
  background: var(--card-2);
}

#package_products{
  height: 220px;
  overflow:auto;
  padding: 8px;
}

.search{
  height: 320px;
  overflow:auto;
  width:100%;
}

/* ---------- Account dropdown ---------- */
#account ul{
  list-style:none;
  margin:0;
  padding:0;
  overflow:hidden;
}
#account li{ margin: 6px; }

#account:hover{
  height:auto;
  display:block;
  background:#ffffff;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(148,163,184,.45);
  border-radius: var(--radius);
}

/* ---------- Utility ---------- */
.w{ width:350px; }

.blank{ border:none; }
.blank td{ border:none; }

/* ---------- Responsive: sidebar -> topbar ---------- */
@media (max-width: 980px){
  #sidebar{
    position: sticky;
    top:0;
    width:100%;
    height:auto;
    z-index: 80;
    border-right:none;
    box-shadow: 0 18px 40px rgba(2,6,23,.12);
  }

  #sidebar ul{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
  }

  #sidebar li{ margin:0; }

  #sidebar ul li a{
    width:auto;
    border-radius: 999px;
  }

  #content{
    margin-left:0;
    width:100%;
    padding: 12px;
  }
}

/* ---------- Reduced motion support ---------- */
@media (prefers-reduced-motion: reduce){
  *{
    transition:none !important;
    animation:none !important;
  }
}
