/* css/components.css - Shared UI Components */

/* Buttons */
.btn {
  height: 40px;
  border: 1px solid rgba(27,31,36,0.15);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: 0.2s cubic-bezier(0.3, 0, 0.5, 1);
  width: 100%;
  box-shadow: var(--shadow-sm);
}
.btn:active { box-shadow: inset 0 2px 4px rgba(0,0,0,0.1); transform: translateY(1px); }

.btn-primary { 
    background-color: #24292F; 
    color: var(--text-inverse); 
    border-color: rgba(27,31,36,0.15);
}
.btn-primary:hover { background-color: #2F363D; }

.btn-secondary { 
    background-color: var(--bg-surface); 
    color: var(--text-primary); 
    border-color: var(--border-default);
}
.btn-secondary:hover { background-color: #F3F4F6; }

.btn-ghost { 
    background-color: transparent; 
    color: var(--text-secondary); 
    border: none; 
    box-shadow: none; 
    height: auto; 
    padding: 8px; 
}
.btn-ghost:hover { background-color: rgba(0,0,0,0.04); color: var(--text-primary); }

.btn-danger { 
    background-color: var(--bg-surface); 
    color: var(--danger); 
    border-color: rgba(207,34,46,0.3); 
}

/* Icon Buttons */
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1px solid transparent;
  transition: all 0.2s;
}
.btn-icon:hover { background-color: rgba(0,0,0,0.04); }

/* Inputs */
.input-group { position: relative; width: 100%; }

.input-field {
  width: 100%;
  height: 40px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  padding: 0 12px; 
  padding-left: 12px; 
  padding-right: 40px; 
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: inset 0 1px 2px rgba(27,31,36,0.075);
}

.input-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.3); 
  background-color: #FFF;
}

html[dir="rtl"] .input-field {
    padding-left: 40px;
    padding-right: 40px;
    text-align: right;
}

/* Cards & Avatars */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-card);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 800;
  color: var(--text-primary);
}

/* Toggle Switch */
.toggle-switch {
  appearance: none;
  width: 40px;
  height: 24px;
  background: #EFF2F5;
  border: 1px solid var(--border-default);
  border-radius: 20px;
  position: relative;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.2s cubic-bezier(0.5, 1.5, 0.5, 1);
}
.toggle-switch:checked { background: #2DA44E; border-color: #2DA44E; }
.toggle-switch:checked::after { transform: translateX(16px); }

/* --- Modals (Base Structure) --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(27, 31, 36, 0.5);
    backdrop-filter: blur(2px);
    z-index: 1000;
    display: flex; justify-content: center; align-items: flex-end;
    opacity: 0; visibility: hidden;
    transition: all 0.2s ease-out;
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-card {
    background: var(--bg-surface);
    width: 100%; max-width: 500px;
    border-radius: 12px 12px 0 0;
    padding: 24px;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.15);
    transform: translateY(100%);
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex; flex-direction: column; gap: 16px;
    max-height: 85vh; overflow-y: auto;
    border-top: 1px solid var(--border-default);
}

@media (min-width: 600px) {
    .modal-overlay { align-items: center; }
    .modal-card { border-radius: 12px; transform: translateY(20px) scale(0.98); border: 1px solid var(--border-default); }
}

.modal-overlay.active .modal-card { transform: translateY(0) scale(1); }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.modal-title { font-size: 18px; font-weight: 600; }

.modal-close {
    background: transparent;
    border: none;
    width: 32px; height: 32px;
    border-radius: 6px;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer;
    color: var(--text-secondary);
}
.modal-close:hover { background-color: rgba(0,0,0,0.05); color: var(--text-primary); }