/* =========================================================
   MartiMaamule (BMDMS) — Global Style
   Palette inspired by Somaliland flag + Local Government green
========================================================= */

/* ---------------------------
   Root Theme Variables
---------------------------- */
:root{
  /* Somaliland-inspired */
  --sl-green: #0b7a3b;
  --sl-white: #ffffff;
  --sl-red:   #d71f2a;
  --sl-black: #111111;

  /* Municipality green (slightly deeper + official) */
  --gov-green: #0a6b35;
  --gov-green-2:#0f8a45;

  /* UI neutrals */
  --bg:       #f5f7fb;
  --surface:  #ffffff;
  --text:     #1f2937;
  --muted:    #6b7280;
  --border:   #e5e7eb;

  /* Accents */
  --primary:  var(--gov-green);
  --primary-2:var(--gov-green-2);
  --danger:   var(--sl-red);
  --dark:     var(--sl-black);

  /* Layout */
  --radius:   14px;
  --shadow:   0 10px 30px rgba(15, 23, 42, .08);
  --shadow-sm:0 6px 16px rgba(15, 23, 42, .08);

  /* Typography */
  --font: system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Helvetica Neue", sans-serif;
}

/* Optional RTL support (for Arabic later) */
html[dir="rtl"] body{
  direction: rtl;
}

/* ---------------------------
   Base
---------------------------- */
*{ box-sizing:border-box; }
html, body{ height:100%; }

body{
  margin:0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height:1.5;
}

a{ color: var(--primary); text-decoration:none; }
a:hover{ text-decoration: underline; }

img{ max-width:100%; display:block; }

/* ---------------------------
   Somaliland Flag Top Bar
   (Green / White / Red stripes)
---------------------------- */
.flag-bar{
  height: 10px;
  width: 100%;
  background: linear-gradient(
    to bottom,
    var(--sl-green) 0%,
    var(--sl-green) 33.33%,
    var(--sl-white) 33.33%,
    var(--sl-white) 66.66%,
    var(--sl-red)   66.66%,
    var(--sl-red)   100%
  );
}

/* ---------------------------
   App Shell Layout
---------------------------- */
.app{
  display:flex;
  min-height:100vh;
}

.sidebar{
  width: 270px;
  background: linear-gradient(180deg, var(--gov-green), #07542a);
  color: #fff;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.main{
  flex: 1;
  padding: 22px;
}

/* ---------------------------
   Top Header
---------------------------- */
.topbar{
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 6px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.brand{
  display:flex;
  align-items:center;
  gap: 10px;
}

.brand .logo{
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #ffffff;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  border: 1px solid rgba(0,0,0,.06);
}

.brand .title{
  display:flex;
  flex-direction:column;
  line-height:1.1;
}
.brand .title strong{
  font-size: 15px;
  letter-spacing:.2px;
}
.brand .title span{
  font-size: 12px;
  color: var(--muted);
}

/* Topbar actions */
.topbar .actions{
  display:flex;
  align-items:center;
  gap: 10px;
}

/* ---------------------------
   Sidebar Items
---------------------------- */
.sidebar .side-head{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  margin-bottom: 12px;
}

.sidebar .side-head .seal{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255,255,255,.95);
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
}

.sidebar .side-head .txt{
  display:flex;
  flex-direction:column;
  line-height:1.1;
}
.sidebar .side-head .txt strong{
  font-size: 14px;
}
.sidebar .side-head .txt span{
  font-size: 12px;
  opacity:.85;
}

.nav{
  display:flex;
  flex-direction:column;
  gap: 6px;
}

.nav a{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: rgba(255,255,255,.92);
  text-decoration:none;
  transition: all .15s ease;
}

.nav a:hover{
  background: rgba(255,255,255,.12);
  transform: translateY(-1px);
}

.nav a.active{
  background: rgba(255,255,255,.18);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}

.nav .dot{
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255,255,255,.75);
}
.nav a.active .dot{
  background: var(--sl-white);
}

/* ---------------------------
   Cards / Sections
---------------------------- */
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

.card + .card{ margin-top: 14px; }

.card .card-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.card .card-title h3{
  margin:0;
  font-size: 15px;
}
.card .card-title .hint{
  font-size: 12px;
  color: var(--muted);
}

/* ---------------------------
   Stats Tiles
---------------------------- */
.grid{
  display:grid;
  gap: 14px;
}

.grid.cols-4{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2{ grid-template-columns: repeat(2, minmax(0, 1fr)); }

.stat{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  position:relative;
  overflow:hidden;
}

.stat:before{
  content:"";
  position:absolute;
  top:0;
  left:0;
  height: 4px;
  width: 100%;
  background: linear-gradient(90deg, var(--sl-green), var(--sl-white), var(--sl-red));
}

.stat .label{
  font-size: 12px;
  color: var(--muted);
}
.stat .value{
  margin-top: 6px;
  font-size: 20px;
  font-weight: 800;
}

/* ---------------------------
   Buttons
---------------------------- */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor:pointer;
  font-weight: 700;
  font-size: 13px;
  transition: all .15s ease;
  user-select:none;
}

.btn-primary{
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover{ background: var(--primary-2); transform: translateY(-1px); }

.btn-outline{
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover{ border-color: #cbd5e1; transform: translateY(-1px); }

.btn-danger{
  background: var(--danger);
  color:#fff;
}
.btn-danger:hover{ filter: brightness(.95); transform: translateY(-1px); }

.btn-dark{
  background: var(--dark);
  color:#fff;
}
.btn-dark:hover{ filter: brightness(1.05); transform: translateY(-1px); }

/* ---------------------------
   Forms
---------------------------- */
.input, select, textarea{
  width:100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  outline: none;
  transition: box-shadow .15s ease, border-color .15s ease;
  font-size: 14px;
}

.input:focus, select:focus, textarea:focus{
  border-color: rgba(11, 122, 59, .35);
  box-shadow: 0 0 0 4px rgba(11, 122, 59, .12);
}

label{
  display:block;
  font-size: 12px;
  color: var(--muted);
  margin: 10px 0 6px;
}

/* ---------------------------
   Tables
---------------------------- */
.table{
  width:100%;
  border-collapse: collapse;
  overflow:hidden;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.table th, .table td{
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  text-align:left;
  font-size: 13px;
}

.table th{
  font-size: 12px;
  color: #374151;
  background: #f8fafc;
}

.table tr:hover td{
  background: #fbfdff;
}

.badge{
  display:inline-flex;
  align-items:center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: #f8fafc;
}

.badge.success{ border-color: rgba(11,122,59,.25); background: rgba(11,122,59,.08); color: var(--gov-green); }
.badge.danger{ border-color: rgba(215,31,42,.25); background: rgba(215,31,42,.08); color: var(--danger); }
.badge.dark{ border-color: rgba(0,0,0,.18); background: rgba(0,0,0,.06); color: #111; }

/* ---------------------------
   Alerts
---------------------------- */
.alert{
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
}
.alert.success{
  border-color: rgba(11,122,59,.25);
  background: rgba(11,122,59,.07);
}
.alert.error{
  border-color: rgba(215,31,42,.25);
  background: rgba(215,31,42,.07);
}

/* ---------------------------
   Login Page
---------------------------- */
.auth-wrap{
  min-height: 100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 22px;
  background:
    radial-gradient(900px 320px at 20% 10%, rgba(11,122,59,.12), transparent 55%),
    radial-gradient(800px 320px at 80% 90%, rgba(215,31,42,.10), transparent 55%),
    var(--bg);
}

.auth-card{
  width: min(960px, 100%);
  display:grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 14px;
}

.auth-left{
  border-radius: 18px;
  background: linear-gradient(160deg, var(--gov-green), #064a25);
  color:#fff;
  padding: 22px;
  box-shadow: var(--shadow);
  position:relative;
  overflow:hidden;
}

.auth-left:after{
  content:"";
  position:absolute;
  inset:0;
  background: linear-gradient(
    to bottom,
    rgba(255,255,255,.10),
    rgba(255,255,255,0)
  );
  pointer-events:none;
}

.auth-left .seal{
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: rgba(255,255,255,.95);
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  margin-bottom: 12px;
}

.auth-left h1{
  margin: 0 0 8px;
  font-size: 22px;
}
.auth-left p{
  margin:0;
  opacity:.92;
  font-size: 13px;
}

.auth-right{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.auth-right h2{
  margin:0 0 10px;
  font-size: 16px;
}

/* ---------------------------
   Responsive
---------------------------- */
@media (max-width: 1100px){
  .grid.cols-4{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 900px){
  .sidebar{ display:none; }
  .main{ padding: 16px; }
  .auth-card{ grid-template-columns: 1fr; }
}

@media (max-width: 520px){
  .grid.cols-2, .grid.cols-3, .grid.cols-4{ grid-template-columns: 1fr; }
  .topbar{ flex-direction: column; align-items:flex-start; }
}
