/*
|--------------------------------------------------------------------------
| MASAR HR Clean Style
|--------------------------------------------------------------------------
| نسخة نظيفة كاملة بدون تعارضات الموبايل
| ارفع الملف باسم:
| public_html/style.css
|--------------------------------------------------------------------------
*/

:root{
  --dark:#120205;
  --dark2:#260307;
  --primary:#5B0F1A;
  --primary2:#7A1A2A;
  --primary3:#8C2630;
  --gold:#F28B2E;
  --gold2:#FFB45B;
  --text:#211716;
  --muted:#8b7a76;
  --white:#fff;
  --glass:rgba(255,255,255,.88);
  --glass2:rgba(255,255,255,.76);
  --border:rgba(255,255,255,.22);
  --border2:rgba(91,15,26,.14);
  --shadow:0 24px 70px rgba(21,2,1,.24);
  --radius:26px;
}

*{
  box-sizing:border-box;
}

html,
body{
  min-height:100%;
  margin:0;
  padding:0;
  width:100%;
  max-width:100%;
  overflow-x:hidden;
}

body{
  font-family:Arial,Tahoma,sans-serif;
  direction:rtl;
  color:var(--text);
  background:var(--dark);
}

a{
  text-decoration:none;
  color:inherit;
}

/* Background */
.masar-bg{
  position:fixed;
  inset:0;
  z-index:0;
  pointer-events:none;
  overflow:hidden;
  background:
    radial-gradient(circle at 78% 18%,rgba(242,139,46,.22),transparent 18%),
    linear-gradient(135deg,#120205 0%,#2A0308 38%,#5B0F1A 72%,#7A2B0D 100%);
}

.masar-bg canvas{
  width:100%;
  height:100%;
  display:block;
}

.masar-bg:after{
  content:"";
  position:absolute;
  inset:0;
  background:
    linear-gradient(90deg,rgba(0,0,0,.42),transparent 45%,rgba(0,0,0,.18)),
    radial-gradient(circle at center,transparent 10%,rgba(0,0,0,.35) 78%);
}

/* Login */
.login-page{
  position:relative;
  z-index:5;
  min-height:100vh;
  display:grid;
  grid-template-columns:1.1fr .9fr;
}

.login-brand{
  color:#fff;
  padding:68px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  position:relative;
  overflow:hidden;
}

.login-brand:before,
.login-brand:after{
  content:"";
  position:absolute;
  width:820px;
  height:145px;
  right:-130px;
  top:215px;
  background:linear-gradient(90deg,transparent,rgba(242,139,46,.24),transparent);
  transform:rotate(-21deg);
}

.login-brand:after{
  top:355px;
  right:65px;
  opacity:.48;
}

.login-logo{
  width:250px;
  max-width:85%;
  position:relative;
  z-index:2;
  margin-bottom:28px;
  filter:drop-shadow(0 20px 32px rgba(0,0,0,.34));
}

.login-brand h1{
  position:relative;
  z-index:2;
  font-size:56px;
  margin:0;
  font-weight:900;
}

.login-brand p{
  position:relative;
  z-index:2;
  max-width:620px;
  font-size:19px;
  line-height:1.9;
  color:#fff2df;
  margin:18px 0 0;
}

.login-form-wrap{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:42px;
}

.card,
.stat-card,
.check-card,
.login-card{
  background:var(--glass);
  backdrop-filter:blur(22px);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}

.login-card{
  width:100%;
  max-width:460px;
  padding:28px;
}

.login-card h2{
  color:var(--dark);
  font-size:32px;
  margin:0 0 8px;
  font-weight:900;
}

/* App Layout */
.layout{
  min-height:100vh;
  display:flex;
  position:relative;
  z-index:5;
}

.sidebar{
  width:305px;
  min-height:100vh;
  position:fixed;
  top:0;
  bottom:0;
  inset-inline-start:0;
  z-index:20;
  padding:24px 18px;
  color:#fff;
  background:
    radial-gradient(circle at 20% 5%,rgba(242,139,46,.18),transparent 28%),
    linear-gradient(180deg,rgba(18,2,5,.98),rgba(91,15,26,.94) 56%,rgba(122,26,42,.94));
  border-inline-end:1px solid rgba(255,255,255,.08);
  box-shadow:25px 0 70px rgba(0,0,0,.28);
  overflow:hidden;
}

.sidebar:before{
  content:"";
  position:absolute;
  width:620px;
  height:170px;
  right:-230px;
  top:170px;
  background:linear-gradient(90deg,transparent,rgba(242,139,46,.18),transparent);
  transform:rotate(-25deg);
}

.side-logo{
  position:relative;
  z-index:2;
  display:flex;
  align-items:center;
  gap:13px;
  padding:10px;
  margin-bottom:30px;
}

.side-logo img{
  width:88px;
  height:auto;
  filter:drop-shadow(0 16px 24px rgba(0,0,0,.34));
}

.side-logo strong{
  display:block;
  font-size:24px;
  font-weight:900;
}

.side-logo span{
  display:block;
  font-size:12px;
  color:#ffd99a;
  margin-top:4px;
  line-height:1.5;
}

.nav{
  position:relative;
  z-index:2;
  display:flex;
  flex-direction:column;
  gap:9px;
}

.nav a{
  display:flex;
  align-items:center;
  gap:10px;
  padding:14px 15px;
  border-radius:17px;
  color:#fff;
  font-weight:800;
  opacity:.9;
  transition:.22s;
}

.nav a:hover,
.nav a.active{
  opacity:1;
  background:rgba(255,255,255,.14);
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.09);
  transform:translateX(-4px);
}

.mobile-header{
  display:none;
}

.main{
  margin-inline-start:305px;
  width:calc(100% - 305px);
  min-height:100vh;
  padding:30px;
  position:relative;
  z-index:10;
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:22px 26px;
  margin-bottom:24px;
  border-radius:30px;
  background:var(--glass);
  backdrop-filter:blur(22px);
  border:1px solid var(--border);
  box-shadow:var(--shadow);
}

.topbar h1{
  margin:0;
  font-size:32px;
  font-weight:900;
  color:var(--dark);
}

.topbar p{
  margin:7px 0 0;
  color:var(--muted);
}

.user-pill{
  padding:12px 18px;
  border-radius:999px;
  color:#fff;
  font-weight:900;
  background:linear-gradient(135deg,var(--primary),var(--primary2));
  box-shadow:0 18px 40px rgba(91,15,26,.30);
}

.card{
  padding:26px;
}

.grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(230px,1fr));
  gap:18px;
}

.stat-card{
  padding:26px;
  position:relative;
  overflow:hidden;
}

.stat-card:before{
  content:"";
  position:absolute;
  width:140px;
  height:140px;
  border-radius:50%;
  top:-48px;
  left:-42px;
  background:radial-gradient(circle,rgba(242,139,46,.24),transparent 68%);
}

.stat-label{
  color:var(--muted);
  font-weight:800;
  font-size:14px;
}

.stat-number{
  font-size:42px;
  font-weight:900;
  color:var(--primary);
  margin-top:12px;
}

.check-card{
  padding:44px 34px;
  text-align:center;
  position:relative;
  overflow:hidden;
  background:radial-gradient(circle at 16% 0%,rgba(242,139,46,.24),transparent 30%),rgba(255,255,255,.88);
}

.check-card:after{
  content:"";
  position:absolute;
  width:600px;
  height:130px;
  right:-120px;
  top:75px;
  transform:rotate(-18deg);
  background:linear-gradient(90deg,transparent,rgba(242,139,46,.16),transparent);
}

.check-card>*{
  position:relative;
  z-index:2;
}

.check-card h2{
  margin:0 0 14px;
  font-size:34px;
  font-weight:900;
  color:var(--dark);
}

.countdown{
  margin-top:22px;
  font-size:38px;
  font-weight:900;
  color:var(--primary);
}

#graceWarning{
  margin-top:14px;
  color:#d87500;
  font-size:16px;
  font-weight:900;
}

/* Buttons */
.btn{
  border:0;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border-radius:18px;
  padding:14px 20px;
  font-size:15px;
  font-weight:900;
  transition:.22s;
}

.btn-primary{
  color:#fff;
  background:linear-gradient(135deg,var(--primary),var(--primary3));
  box-shadow:0 18px 42px rgba(91,15,26,.30);
}

.btn-primary:hover{
  transform:translateY(-2px);
  box-shadow:0 24px 50px rgba(91,15,26,.36);
}

.btn-accent{
  color:#2A0308;
  background:linear-gradient(135deg,var(--gold),var(--gold2));
}

.btn-block{
  width:100%;
}

.big-check{
  min-width:280px;
  padding:20px 42px;
  font-size:20px;
  border-radius:22px;
}

button:disabled,
.btn:disabled{
  opacity:.62;
  cursor:not-allowed;
  transform:none!important;
}

/* Forms */
label{
  font-weight:800;
}

.input,
select,
textarea{
  width:100%;
  padding:15px 16px;
  border-radius:18px;
  border:1px solid rgba(91,15,26,.16);
  background:rgba(255,255,255,.94);
  font-size:15px;
  margin:8px 0 16px;
  outline:none;
  color:var(--text);
}

textarea{
  min-height:120px;
}

.input:focus,
select:focus,
textarea:focus{
  border-color:var(--gold);
  box-shadow:0 0 0 4px rgba(242,139,46,.14);
}

.form-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(230px,1fr));
  gap:16px;
}

/* Alerts */
.alert{
  padding:15px 17px;
  border-radius:18px;
  margin:14px 0;
  font-weight:900;
}

.alert-success{
  background:#dcfce7;
  color:#166534;
}

.alert-warning{
  background:#fff7df;
  color:#92400e;
}

.alert-error{
  background:#fee2e2;
  color:#991b1b;
}

/* Tables */
.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  overflow:hidden;
  border-radius:22px;
  border:1px solid rgba(91,15,26,.12);
  background:rgba(255,255,255,.90);
}

.table th,
.table td{
  padding:16px;
  border-bottom:1px solid rgba(91,15,26,.10);
  text-align:right;
}

.table th{
  color:var(--primary);
  background:linear-gradient(135deg,#fff8ef,#fff3e3);
  font-weight:900;
}

.table tr:last-child td{
  border-bottom:0;
}

.table tr:hover td{
  background:#fffaf4;
}

.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:7px 12px;
  border-radius:999px;
  font-size:13px;
  font-weight:900;
}

.badge-present{
  background:#dcfce7;
  color:#166534;
}

.badge-late{
  background:#fff7df;
  color:#92400e;
}

.badge-break,
.badge-warning{
  background:#fff1d6;
  color:#9a4d00;
}

.badge-missing{
  background:#fee2e2;
  color:#991b1b;
}

/* Mobile - single clean block */
@media(max-width:900px){

  html,
  body{
    width:100%;
    max-width:100%;
    min-width:0;
    overflow-x:hidden;
  }

  body{
    margin:0;
    padding:0;
  }

  .login-page{
    min-height:100svh;
    display:flex;
    flex-direction:column;
    justify-content:center;
    padding:18px;
  }

  .login-brand{
    padding:0;
    align-items:center;
    text-align:center;
    margin:0 0 18px;
  }

  .login-brand:before,
  .login-brand:after{
    display:none;
  }

  .login-logo{
    width:150px;
    margin:0 auto 10px;
  }

  .login-brand h1{
    font-size:34px;
    margin:0;
  }

  .login-brand p{
    display:none;
  }

  .login-form-wrap{
    padding:0;
    width:100%;
  }

  .login-card{
    max-width:430px;
    margin:0 auto;
    padding:22px;
    border-radius:24px;
  }

  .login-card h2{
    text-align:center;
    font-size:26px;
  }

  .layout{
    display:block;
    min-height:100svh;
    width:100%;
    margin:0;
    padding:0;
  }

  .mobile-header{
    display:flex;
    position:sticky;
    top:0;
    z-index:9000;
    width:100%;
    min-height:66px;
    align-items:center;
    justify-content:space-between;
    padding:10px 14px;
    background:rgba(18,2,5,.94);
    backdrop-filter:blur(18px);
    border-bottom:1px solid rgba(255,255,255,.12);
  }

  .mobile-brand{
    display:flex;
    align-items:center;
    gap:10px;
    color:#fff;
    font-weight:900;
    min-width:0;
  }

  .mobile-brand img{
    width:48px;
    height:48px;
    object-fit:contain;
    flex:0 0 auto;
  }

  .mobile-brand span{
    display:block;
    max-width:190px;
    overflow:hidden;
    white-space:nowrap;
    text-overflow:ellipsis;
    font-size:17px;
  }

  .menu-toggle{
    width:46px;
    height:46px;
    min-width:46px;
    border:0;
    border-radius:14px;
    background:rgba(255,255,255,.12);
    color:#fff;
    font-size:25px;
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    position:relative;
    z-index:9200;
  }

  .sidebar{
    position:fixed;
    top:0;
    right:0;
    bottom:0;
    width:min(86vw,330px);
    max-width:330px;
    height:100svh;
    min-height:100svh;
    padding:18px 14px;
    z-index:9100;
    transform:translateX(110%);
    transition:transform .25s ease;
    overflow-y:auto;
    overflow-x:hidden;
    border-radius:0 0 0 22px;
    box-shadow:-20px 0 60px rgba(0,0,0,.35);
  }

  body.menu-open .sidebar,
  body.sidebar-open .sidebar{
    transform:translateX(0);
  }

  body.menu-open:after,
  body.sidebar-open:after{
    content:"";
    position:fixed;
    inset:0;
    z-index:9050;
    background:rgba(0,0,0,.48);
  }

  body.menu-open,
  body.sidebar-open{
    overflow:hidden;
  }

  .side-logo{
    gap:10px;
    padding:8px 4px 18px;
    margin-bottom:12px;
  }

  .side-logo img{
    width:58px;
  }

  .side-logo strong{
    font-size:20px;
  }

  .nav{
    gap:8px;
  }

  .nav a{
    min-height:48px;
    padding:12px 14px;
    border-radius:14px;
    font-size:15px;
  }

  .main{
    margin:0;
    width:100%;
    min-height:calc(100svh - 66px);
    padding:16px;
  }

  .topbar{
    display:block;
    text-align:center;
    padding:18px;
    margin:0 0 16px;
    border-radius:24px;
  }

  .topbar h1{
    font-size:26px;
    line-height:1.25;
  }

  .user-pill{
    margin-top:14px;
    display:inline-flex;
    justify-content:center;
    max-width:100%;
    white-space:normal;
    line-height:1.4;
  }

  .check-card{
    padding:26px 18px;
    border-radius:24px;
  }

  .check-card h2{
    font-size:27px;
  }

  .countdown{
    font-size:28px;
    line-height:1.35;
  }

  #graceWarning{
    font-size:15px;
    line-height:1.6;
  }

  .big-check{
    min-width:100%;
    width:100%;
    font-size:18px;
    min-height:60px;
  }

  .grid,
  .form-grid{
    grid-template-columns:1fr;
    gap:14px;
  }

  .card,
  .stat-card{
    padding:18px;
    border-radius:22px;
  }

  .input,
  select,
  textarea{
    height:52px;
    font-size:16px;
  }

  textarea{
    height:auto;
  }

  .btn{
    min-height:54px;
    font-size:16px;
    width:100%;
  }

  .table{
    display:block;
    width:100%;
    overflow-x:auto;
    white-space:nowrap;
    -webkit-overflow-scrolling:touch;
  }

  .table th,
  .table td{
    padding:12px 10px;
  }
}

@media(max-width:420px){
  .main{
    padding:12px 10px;
  }

  .mobile-brand span{
    max-width:150px;
  }

  .topbar h1{
    font-size:24px;
  }

  .check-card h2{
    font-size:24px;
  }

  .countdown{
    font-size:25px;
  }
}
