/* crm/styles.css */
:root{
  --primary-color:#002977;
  --primary-light:#f9f9f9;
  --secondary-color:#f97316;
  --discount-color:#ef4444;
  --text-color:#002977;
  --modal-header-color:#fff;
  --bg-color:#f5f7fa;
  --border-color:#eee;
  --white:#fff;
  --shadow:0 2px 8px rgba(0,0,0,0.25);
  --shadow-hover:0 6px 15px rgba(182,32,45,0.1);

  /* colors */
  --blue-color:#478dff;
  --green-color:#29d199;
  --red-color:#f87171;
  --orange-color:#f97316;
  --dark-blue-color:#2563eb;
  --dark-green-color:#059669;
  --dark-red-color:#e04141;
  --dark-orange-color:#db4e27;
  --light-blue-color:#709dff;
  --light-green-color:#afddb0;
  --light-red-color:#ff9999;
  --light-orange-color:#ffaf72;
}

[data-theme="dark"]{
  --primary-color:#111;
  --primary-light:#333;
  --secondary-color:#333;
  --text-color:#f9f9f9;
  --bg-color:#111;
  --border-color:#2B4259;
  --activity-card:#333;
  --blue-color:#2563eb;
  --green-color:#059669;
  --red-color:#e04141;
  --orange-color:#db4e27;
}

@font-face{
  font-family:'Yekan Bakh';
  src:url('/static/fonts/YekanBakh-Light.ttf') format('truetype');
  font-weight:300;
  font-style:normal;
  font-display:swap;
}

@font-face{
  font-family:'Yekan Bakh';
  src:url('/static/fonts/YekanBakh-Regular.ttf') format('truetype');
  font-weight:400;
  font-style:normal;
  font-display:swap;
}

@font-face{
  font-family:'Yekan Bakh';
  src:url('/static/fonts/YekanBakh-Medium.ttf') format('truetype');
  font-weight:500;
  font-style:normal;
  font-display:swap;
}

@font-face{
  font-family:'Yekan Bakh';
  src:url('/static/fonts/YekanBakh-Bold.ttf') format('truetype');
  font-weight:700;
  font-style:normal;
  font-display:swap;
}

body{
  font-family:'Yekan Bakh',Tahoma,sans-serif;
  color:var(--text-color);
  line-height:1.6;
  direction:rtl;
}

*{
  font-family:'Yekan Bakh';
  box-sizing:border-box;
  margin:0;
  padding:0;
}

hr{
  border-bottom:0.5px solid var(--border-color);
  margin:8px auto;
  width:100%;
}

form{
  max-width:100%;
  margin:0 auto;
}

a{
  text-decoration:none;
}

li{
  font-size:13px;
  line-height:2.4;
}

small a{
  background:var(--primary-color);
  padding:6px 10px;
  border-radius:4px;
  margin-left:4px;
}

.form-label{
  display:block;
  margin-bottom:6px;
  font-size:14px;
  color:#555;
  font-weight:500;
}

.file-name{
  font-size:13px;
  color:#333;
  max-width:200px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.file-name.placeholder{
  color:#999;
}

.form-control{
  padding:10px 14px;
  font-family:inherit;
  font-size:14px;
  background:#fbfbfb;
  transition:all 0.2s;
  background:white;
}

.form-control[multiple]{
  height:120px;
  resize:vertical;
}

.form-group label{
  display:block;
  margin-bottom:4px;
  font-size:13px;
  font-weight:600;
  color:#34495e;
}

.form-group input,.form-group select,.form-group textarea{
  width:100%;
  padding:11px 12px;
  border:1px solid #f0f0f0;
  border-radius:8px;
  font-size:13px;
  cursor:pointer;
}

.form-group input:focus,.form-group select:focus,.form-group textarea:focus{
  border:2px solid #3498db;
  outline:none;
}

.form-group small{
  margin-top:4px;
  font-size:12px;
  font-weight:500;
  color:var(--orange-color);
}

.attachment-preview img{
  max-height:220px;
  border:1px solid #ecf0f1;
  border-radius:4px;
  cursor:pointer;
}

.attachment-preview a{
  color:white;
}

.badge{
  display:inline-block;
  padding:3px 8px;
  border-radius:12px;
  font-size:11px;
  margin-right:5px;
  background:#f0f0f0;
  color:#333;
}

.badge.green{
  background:#4caf50;
  color:white;
}

.badge.orange{
  background:#ff9800;
  color:white;
}

.badge.blue{
  background:#2196f3;
  color:white;
}

.btn-primary,.btn-secondary,.btn-negative,.submit-btn,.upload-btn{
  color:white;
  padding:10px 24px;
  border:none;
  border-radius:6px;
  font-size:15px;
  gap:6px;
  cursor:pointer;
  align-items:center;
  font-weight:500;
}

.upload-btn{
  background:white;
  color:var(--dark-orange-color);
}

.btn-primary{
  background:var(--primary-color);
}

.btn-secondary{
  background:var(--secondary-color);
}

.btn-negative{
  background-color:var(--dark-red-color);
}

.submit-btn{
  background-color:var(--secondary-color);
}

.submit-btn:hover{
  background:var(--dark-orange-color);
}

.submit-btn:disabled{
  opacity:0.6;
  cursor:not-allowed;
}

.main-content,.main-content-full{
  flex:1;
  margin:0 260px 32px 0;
  padding:8px 12px;
  transition:margin-right 0.3s ease;
  width:calc(100% - 260px);
  min-height:calc(100vh - 40px);
  background:var(--bg-color);
}

.main-content-full{
  padding:8px 12px;
  margin:0;
  width:100%;
  min-height:100vh;
}

.top-bar{
  position:fixed;
  height:40px;
  margin:0 260px 32px 0;
  width:calc(100% - 260px);
  left:0;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.sticky-footer-bar{
  bottom:0;
  padding:0 12px;
  z-index:999;
  box-shadow:0 -2px 10px rgba(0,0,0,0.1);
  font-size:12px;
  transition:all 0.3s;
  color:#333;
  background:var(--bg-color);
}

.main-content h3{
  color:var(--text-color);
}

.sidebar.collapsed + .main-content,
.sidebar.collapsed ~ .main-content,
body:has(.sidebar.collapsed) .main-content{
  margin-right:80px !important;
  width:calc(100% - 80px) !important;
}

.sidebar.collapsed + .sticky-footer-bar,
.sidebar.collapsed ~ .sticky-footer-bar,
body:has(.sidebar.collapsed) .sticky-footer-bar{
  right:80px !important;
  width:calc(100% - 80px) !important;
}

.remove-action{
  padding:10px 20px;
  margin-bottom:0.5px;
  border:none;
  border-radius:8px;
  font-size:13px;
  cursor:pointer;
  color:var(--red-color);
  background:#f0f0f0;
}

.remove-action i:hover{
  color:#fff;
  background:var(--red-color);
}

.shortcut-cards{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:12px;
  margin-bottom:12px;
}

.shortcut-card{
  border-radius:12px;
  padding:16px 20px;
  height:120px;
  text-align:center;
  cursor:pointer;
  box-shadow:0 4px 8px rgba(0,0,0,0.15);
}

.shortcut-card:hover{
  box-shadow:0 6px 12px rgba(0,0,0,0.3);
}

.shortcut-card .title{
  color:#fff;
  font-size:18px;
}

.shortcut-card-value{
  color:#fff;
  font-size:18px;
}

.shortcut-card i{
  color:#fff;
  font-size:22px;
}

.dashboard-cards{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:12px;
  margin:0 0 12px 0;
}

.dashboard-card{
  border-radius:12px;
  padding:16px 20px;
  box-shadow:0 4px 15px rgba(0,0,0,0.05);
  transition:all 0.3s;
  border-top:4px solid var(--green-color);
  position:relative;
  overflow:hidden;
  height:120px;
  background:white;
}

.dashboard-card:hover{
  transform:translateY(-3px);
  cursor:pointer;
  box-shadow:0 8px 25px rgba(0,0,0,0.1);
}

.dashboard-card:nth-child(2){
  border-top:4px solid var(--blue-color);
}

.dashboard-card:nth-child(3){
  border-top:4px solid var(--orange-color);
}

.dashboard-card:nth-child(4){
  border-top:4px solid var(--red-color);
}

.dashboard-card-icon{
  position:absolute;
  left:20px;
  top:25px;
  width:42px;
  height:42px;
  border-radius:10px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:22px;
  color:white;
}

.dashboard-card:nth-child(1) .dashboard-card-icon{
  background:linear-gradient(135deg,var(--green-color),var(--dark-green-color));
}

.dashboard-card:nth-child(2) .dashboard-card-icon{
  background:linear-gradient(135deg,var(--blue-color),var(--dark-blue-color));
}

.dashboard-card:nth-child(3) .dashboard-card-icon{
  background:linear-gradient(135deg,var(--orange-color),var(--dark-orange-color));
}

.dashboard-card:nth-child(4) .dashboard-card-icon{
  background:linear-gradient(135deg,var(--red-color),var(--dark-red-color));
}

.dashboard-card-info-title{
  font-size:14px;
  color:#7f8c8d;
  margin-bottom:5px;
}

.dashboard-card-info-value{
  font-size:16px;
  font-weight:600;
  color:var(--text-color);
  margin-bottom:10px;
  padding:0;
  margin:0 auto;
  height:38px;
}

.dashboard-card-info-change{
  font-size:12px;
  display:flex;
  align-items:center;
  gap:5px;
  cursor:pointer;
}

.dashboard-card-info-change.positive{
  color:var(--dark-green-color);
}

.dashboard-card-info-change.negative{
  color:var(--red-color);
}

.activity-card{
  color:var(--text-color);
  background:white;
  margin-bottom:14px;
}

.activity-card hr{
  width:100%;
  padding:0;
  margin:18px 0;
  border:0.5px solid #eee;
}

.activity-card,.no-result{

  border-radius:12px;
  padding:14px 16px;
  box-shadow:0 2px 4px rgba(0,0,0,0.1);
  margin-bottom:18px;
}

.activity-card p{
  font-size:14px;
  font-weight:500;
}

.activity-log{
  margin:12px 0;
}

.activity-card small{
  font-size:12px;
  color:#666;
}

.no-result{
  text-align:center;
}

.no-result p{
  color:var(--primary-color);
  margin:12px 0;
}

.page-actions{
  display:flex;
  gap:10px;
}

.page-header{
  background:linear-gradient(135deg,#003aa0 45%,#002977 100%);
  color:var(--white);
  padding:34px 30px;
  border-radius:12px;
  max-width:920px;
  margin:8px auto;
  text-align:center;
  box-shadow:var(--shadow);
  position:relative;
  overflow:hidden;
}

.header::before{
  content:'';
  position:absolute;
  top:0;
  right:0;
  width:200px;
  height:200px;
  background:rgba(255,255,255,0.1);
  border-radius:50%;
  transform:translate(30%,-30%);
}

.header::after{
  content:'';
  position:absolute;
  bottom:0;
  left:0;
  width:150px;
  height:150px;
  background:rgba(255,255,255,0.05);
  border-radius:50%;
  transform:translate(-30%,30%);
}

.header h1{
  font-size:18px;
  font-weight:500;
  margin-bottom:15px;
  position:relative;
  z-index:1;
  text-shadow:0 2px 4px rgba(0,0,0,0.2);
}

.header p{
  font-size:14px;
  line-height:2;
  margin:0 auto;
  position:relative;
  z-index:1;
  font-weight:400;
  text-align:center;
}

.activity-title{
  font-size:16px;
  color:var(--text-color);
  font-weight:600;
  margin-bottom:20px;
  display:flex;
  align-items:center;
  gap:10px;
}

.footer{
  margin-top:30px;
  padding:12px 0 0 0;
  text-align:center;
  color:#7f8c8d;
  font-size:12px;
  border-top:1px solid #e1e5e9;
}

.table-responsive{
  overflow-x:0 auto;
  font-size:13px;
}

.transactions-table{
  width:100%;
  border-collapse:collapse;
}

.card-actions{
  display:flex;
  gap:8px;
}

.card-actions a{
  color:var(--blue-color);
  font-size:13px;
  transition:all 0.2s;
  width:32px;
  height:32px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:8px;
  margin-bottom:12px;
}

.card-actions a:hover{
  color:#e9ecef;
  background:var(--blue-color);
}

.transactions-table th,
.transactions-table td{
  padding:12px 14px;
  text-align:center;
  border-bottom:1px solid var(--border-color);
}

.transactions-table th{
  background-color:var(--primary-light);
  font-weight:500;
  color:var(--text-color);
}

.transactions-table tr:hover{
  background-color:var(--primary-light);
}

td a i{
  color:var(--blue-color);
}

.tabs-container{
  margin:0 0 20px 0;
  border-radius:0 0 12px 12px;
  box-shadow:0 2px 4px rgba(0,0,0,0.1);
  border-top:0.5px solid #eaeaea;
}

.tab-btn{
  padding:13px 15px;
  background:transparent;
  border:none;
  border-bottom:2px solid transparent;
  cursor:pointer;
  font-size:12px;
  font-weight:500;
  color:var(--text-color);
  background:#ffe9db;
  border-radius:6px 6px 0 0;
  margin-left:4px;
  min-width:100px;
}

.tab-btn:hover{
  color:#fff;
  background:var(--secondary-color);
}

.tab-btn.active{
  font-weight:600;
  border-radius:6px 6px 0 0;
  color:#fff;
  background:var(--secondary-color);
}

.tabs-scroll{
  display:flex;
  overflow-x:auto;
  align-items:center;
  scroll-behavior:smooth;
  padding:0 0;
}

.tab{
  flex:0 0 auto;
  overflow:hidden;
}

.tabs-scroll::-webkit-scrollbar{
  display:none;
}

.tabs-header{
  width:100%;
  display:flex;
  flex-wrap:wrap;
  gap:auto;
}

.tab-content{
  display:none;
  padding:8px 20px;
  background:#fff;
  border-radius:0 0 12px 12px
}

.tab-content.active{
  display:block;
}

.form-text{
  color:#999;
}

.modal{
  display:none;
  position:fixed;
  top:0;
  left:0;
  right:0;
  bottom:0;
  background-color:rgba(0,0,0,0.6);
  backdrop-filter:blur(10px);
  z-index:1000;
  width:100vw;
  height:100vh;
  align-items:center;
  justify-content:center;
}

.modal-content{
    background-color:var(--bg-color);
    margin:auto;
    box-shadow:0 10px 30px rgba(0,0,0,0.2);
    width:90%;
    max-width:1240px;
    max-height:96vh;
    overflow-y:auto;
    border-radius:0px;
    margin-top:2%;
    border-radius:16px;
}

.modal-content::-webkit-scrollbar{
  display:none;
}

.modal-header{
  padding:10px 16px;
  background:linear-gradient(135deg,#022c7f,#0038a0);
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.modal-header h3{
  color:var(--modal-header-color);
  font-size:16px;
}

.modal-header .close-modal{
  color:white;
  font-size:24px;
  background:none;
  border:none;
  cursor:pointer;
}

.modal-body{
  padding:4px 18px;
}

.modal-footer{
  display:flex;
  justify-content:flex-end;
  gap:8px;
  padding:18px 0;
}

.archived{
  color:#999;
  background:#eaeaea;
  border:None;
}

.modal.active{
  display:flex;
}

.form-row{
  display:grid;
  grid-template-columns: repeat(4,1fr);
  gap:20px;
  margin-bottom:20px;
}

.form-row .form-group{
  flex:1;
}

.tab-content hr{
  border:0.5px dashed #e5e5e5;
  margin:22px 0;
}

label{
  display:block;
  margin-bottom:8px;
  font-weight:500;
  color:var(--text-color);
  font-size:14px;
  margin-top:12px;
}

.filters-row{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:flex-end;
  margin-bottom:12px;
}

.filter-group{
  flex:1;
  min-width:160px;
}

.filter-group label{
  display:block;
  margin-bottom:5px;
  font-weight:600;
  color:var(--text-color);
  font-size:14px;
}

.filter-grid{
  display:flex;
  gap:20px;
}

.filters-row .date-field{
  padding:7px 8px;
}

.search-box{
  position:relative;
}

.search-box input,.filter-group input,.filter-group select{
  width:100%;
  padding:0 8px;
  border:1px solid var(--border-color);
  border-radius:8px;
  font-size:13px;
  cursor:pointer;
  height:40px;
}

.search-box input:focus,.filter-group input:focus,.filter-group select:focus{
  border:2px solid #3498db;
  outline:none;
}

.pagination{
  display:flex;
  justify-content:center;
  align-items:center;
  margin-top:20px;
  gap:10px;
}

.pagination a,.pagination span{
  display:inline-block;
  padding:8px 16px;
  border:1px solid #ddd;
  border-radius:4px;
  text-decoration:none;
  color:var(--blue-color);
  transition:all 0.3s;
}

.pagination a:hover{
  background-color:var(--blue-color);
  color:white;
  border-color:var(--blue-color);
}

.pagination .current{
  background-color:var(--blue-color);
  color:white;
  border-color:var(--blue-color);
}

.pagination .disabled{
  color:#95a5a6;
  cursor:not-allowed;
}

.header-icons{
  display:flex;
  align-items:center;
  gap:10px;
}

.header-icons i{
  font-size:16px;
  display:flex;
  justify-content:center;
  align-items:center;
  color:var(--text-color);
  cursor:pointer;
}

.separator{
  border-right:1px solid #e5e5e5;
}

.header-icons i:hover{
  color:var(--primary-color);
}

.notification{
  position:fixed;
  top:18px;
  left:14px;
  color:white;
  padding:16px 18px;
  border-radius:10px;
  font-size:16px;
  z-index:9999;
  width:320px;
}

.notification.success{
  background:#10b981;
}

.notification.error{
  background:#ef4444;
}

.empty-state{
  text-align:center;
  padding:8px 0;
  color:#b8c5d4;
}

.empty-state i{
  font-size:26px;
  margin-bottom:12px;
  opacity:0.6;
}

.empty-state p{
  font-size:12px;
}

#id_attachment{
  position:absolute;
  top:0;
  right:0;
  bottom:0;
  left:0;
  width:100%;
  height:100%;
  opacity:0;
  cursor:pointer;
  z-index:2;
}

.product-fields-container hr{
  margin:18px 0 12px 0;
  border:0.5px dashed #ddd;
}

.file-input-wrapper{
  position:relative;
  width:100%;
}

.custom-file-upload{
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-radius:8px;
  cursor:pointer;
  background:white;
  border:1px solid #f0f0f0;
  padding:6px 12px;
}

.file-input-wrapper{
  position:relative;
  width:100%;
}

.custom-file-upload.has-file{
  border-color:#28a745;
  background-color:#f8fff9;
}

.file-upload-left{
  display:flex;
  align-items:center;
  gap:10px;
}

.upload-icon{
  width:30px;
  height:30px;
  border-radius:6px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--primary-color);
}

.upload-icon svg{
  width:18px;
  height:18px;
  fill:white;
}

.status-control{
  background-color:#ffeee2;
  color:var(--orange-color);
  font-size:11px;
  font-weight:600;
  text-align:center;
  border-radius:24px;
  border:1px solid var(--orange-color);
  height:32px;
}

.theme-toggle,
.lock{
  background:None;
  color:var(--primary-color);
  padding:2px 9px;
  border:none;
  cursor:pointer;
  border-radius:24px;
}

.lock{
  padding:2px 8px;
}

.theme-toggle:hover,
.lock:hover{
  color:#f0f0f0;
  background:var(--primary-color);
}

.theme-toggle i,
.lock i{
    font-size:14px;
    margin-top:4px;
}

.sticky-header{
  display:flex;
  justify-content:space-between;
  padding: 4px 0px 12px 8px;
  font-size:16px;
  font-weight:500;
}

.header-left-section,.header-right-section{
  gap:12px;
  display:flex;
}

.header-btn{
  color:var(--primary-color);
  background:white;
  border:none;
  padding:6px 11px;
  border-radius:20px;
  font-size:12px;
  display:flex;
  align-items:center;
  gap:8px;
  cursor:pointer;
  position:relative;
  width:32px;
  height:32px;
}

.header-btn.active{
  color:#fff;
  background:var(--primary-color);
}

.header-btn:hover{
  color:#fff;
  background:var(--primary-color);
}

.active-filters-container{
  margin:10px 0;
  padding:8px 14px;
  background:#fff;
  border-radius:12px;
}

.filter-tags{
  display:flex;
  gap:6px;
}

.filter-tag{
  user-select:none;
  color:#00695c;
  background:#e0f2f1;
  padding:6px 12px;
  font-size:10px;
  border-radius:24px;
  cursor:pointer;
}

.active-filters{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}

.filter-tag:active{
  transform:translateY(0);
}

.filter-tag.negative{
  color:#fff;
  background:red;
}

.search-wrapper{
  position:relative;
  display:flex;
  align-items:center;
  gap:8px;
}

.search-wrapper input{
  width:100%;
  padding:8px 16px;
  border:1px solid #ecf0f1;
  border-radius:8px;
  font-size:13px;
  cursor:pointer;
}

.search-wrapper input:focus{
  border:2px solid #3498db;
  outline:none;
}

.note-item{
  padding:8px 10px;
  border-radius:4px;
  border-bottom:1px solid #e5e5e5;
}

.note-item:last-child{
  border-bottom:none;
}

.note-content{
  flex:1;
}

.note-title{
  color:#555;
}

.note-description{
  font-size:11px;
  color:#777;
  line-height:1.7;
  text-align:justify;
  margin-top:2px;
}

.note-meta{
  font-size:11px;
  color:#999;
  display:flex;
  gap:8px;
}

.note-meta i{
  margin-left:3px;
  font-size:8px;
}

.message-item{
  background:#fafafa;
  margin:6px 0;
  border-right:3px solid #ddd;
}

.message-item.unread{
  background:#f0f7ff;
  border-right:3px solid #3498db;
}

.message-item.unread .note-title{
  color:var(--text-color);
}

.message-item.unread .note-description{
  color:#333;
}

.message-actions{
  text-align:left;
}

.message-view-btn{
  color:var(--primary-color);
  border-radius:4px;
  font-size:11px;
  weight:600;
}

.profile-image{
  display:flex;
  gap:8px;
}

.profile-image img{
  background:#f6f6f6;
  border-radius:48px;
  width:32px;
  height:32px;
  border:1px solid #e5e5e5;
}

@media (max-width:768px){
  .main-content{
    padding:18px 14px;
  }

  .top-bar{
    flex-direction:column;
    align-items:stretch;
    gap:15px;
  }

  .dashboard-cards{
    grid-template-columns:1fr;
  }

  .action-btn{
    padding:6px 12px;
    border-radius:6px;
    text-decoration:none;
    color:white;
    font-size:12px;
    transition:all 0.3s;
  }

  .action-btn.view{
    background-color:var(--blue-color);
  }

  .action-btn.edit{
    background-color:var(--orange-color);
  }

  .action-btn.delete{
    background-color:var(--red-color);
  }

  .action-btn:hover{
    transform:translateY(-2px);
    box-shadow:0 4px 8px rgba(0,0,0,0.2);
  }

  .filters-row{
    flex-direction:column;
  }

  .filter-group{
    min-width:100%;
  }
}
