@font-face {
    font-family: 'CustomFont';
    src: url('https://www.45km.ir/font/font1.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'CustomFont', sans-serif;
}
	
	
	
        :root{
            --app-bg: radial-gradient(circle at top, #0f1c2e, #000 70%);
            --header-bg: rgba(15, 28, 46, 0.9);
            --panel-bg: rgba(15, 28, 46, 0.95);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            background: var(--app-bg);
            font-family: 'CustomFont', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            overflow: hidden;
            direction: rtl;
        }

        .start-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: var(--app-bg);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            gap: 32px;
            z-index: 9999;
            transition: opacity 0.3s ease;
        }

        .start-screen.hidden {
            opacity: 0;
            pointer-events: none;
        }

        .start-logo {
            width: 320px;
            height: auto;
            object-fit: contain;
        }

        /* پیام منتظر ارتباط */
        #waiting-screen .start-logo { width: 90px; }

        .start-button {
            background-color: #00BCD4;
            color: white;
            border: none;
            border-radius: 30px;
            padding: 16px 48px;
            font-size: 20px;
            font-weight: bold;
            cursor: pointer;
            box-shadow: 0 4px 15px rgba(0, 188, 212, 0.4);
            transition: transform 0.2s, background-color 0.2s;
            font-family: inherit;
        }

        .start-button:active {
            transform: scale(0.96);
            background-color: #00a5b5;
        }

        .fixed-header {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 60px;
            background-color: var(--header-bg);
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 16px;
            z-index: 1000;
            box-shadow: 0 2px 8px rgba(0,0,0,0.3);
            direction: ltr;
            backdrop-filter: blur(6px);
        }

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

        .avatar {
            width: 42px;
            height: 42px;
            border-radius: 50%;
            object-fit: cover;
            background-color: #fff;
            border: 2px solid white;
            cursor: pointer;
        }

        .header-info {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
        }

        .header-name {
            color: white;
            font-size: 18px;
            font-weight: bold;
            white-space: nowrap;
            font-family: inherit;
            line-height: 1.2;
        }

        .header-status {
            color: #aaa;
            font-size: 11px;
            white-space: nowrap;
            font-family: inherit;
            line-height: 1.2;
            margin-top: 1px;
        }

        .three-dot-button {
            background: none;
            border: none;
            cursor: pointer;
            padding: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            transition: opacity 0.2s;
        }

        .three-dot-button:hover {
            opacity: 0.8;
        }

        .three-dot-button svg {
            width: 24px;
            height: 24px;
            fill: white;
        }

        .chat-container {
            width: 100%;
            max-width: 420px;
            height: 100%;
            background: transparent;
            display: flex;
            flex-direction: column;
            padding: 16px;
            padding-top: 76px;
            visibility: hidden;
        }

        .chat-container.visible {
            visibility: visible;
        }

        .messages {
            flex: 1;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 12px;
            padding: 10px 0;
            margin-bottom: 16px;
            scrollbar-width: none;
            -ms-overflow-style: none;
        }

        .messages::-webkit-scrollbar {
            display: none;
        }

        .message {
            display: flex;
            flex-direction: column;
            max-width: 80%;
            clear: both;
            position: relative;
            word-wrap: break-word;
        }

        .message.sent {
            margin-left: auto;
            align-items: flex-end;
        }

        .message.received {
            margin-right: auto;
            align-items: flex-start;
        }

        .bubble {
            padding: 10px 14px;
            border-radius: 18px;
            position: relative;
            font-size: 15px;
            line-height: 1.5;
            min-height: 20px;
            overflow: hidden;
            font-family: inherit;
        }

        .message.sent .bubble {
            background-color: #0a84ff;
            color: #fff;
            border-bottom-right-radius: 4px;
        }

        .message.received .bubble {
            background-color: #2c2c2e;
            color: #fff;
            border-bottom-left-radius: 4px;
        }

        .sender-name {
            display: none;
        }

        .cursor {
            display: inline-block;
            vertical-align: middle;
            font-weight: bold;
            color: inherit;
            animation: blink 0.7s infinite;
            margin: 0 2px;
        }

        .typing-dots {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            height: 14px;
        }

        .typing-dots span {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: currentColor;
            opacity: 0.35;
            animation: dotBlink 1s infinite ease-in-out;
        }

        .typing-dots span:nth-child(2) { animation-delay: 0.15s; }
        .typing-dots span:nth-child(3) { animation-delay: 0.3s; }

        @keyframes dotBlink {
            0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
            40% { transform: translateY(-3px); opacity: 1; }
        }

        @keyframes blink {
            0%, 100% { opacity: 1; }
            50% { opacity: 0; }
        }

        .image-message {
            padding: 4px !important;
        }

        .image-message img {
            display: block;
            width: 100%;
            max-width: 240px;
            border-radius: 12px;
            background-color: #e0e0e0;
        }

        .audio-message {
            padding: 12px 16px !important;
            display: flex;
            align-items: center;
            gap: 12px;
            min-width: 200px;
            background-color: #2c2c2e !important;
            border-radius: 18px;
        }

        .play-button {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background-color: #0a84ff;
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            transition: background-color 0.2s;
        }

        .play-button:hover {
            background-color: #0077e6;
        }

        .play-button svg {
            width: 18px;
            height: 18px;
            fill: white;
            margin-left: 2px;
        }

        .audio-track {
            flex: 1;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .progress-bar {
            flex: 1;
            height: 4px;
            background-color: #555;
            border-radius: 2px;
            position: relative;
            cursor: pointer;
            overflow: hidden;
        }

        .progress-fill {
            height: 100%;
            width: 0%;
            background-color: #fff;
            border-radius: 2px;
            transition: width 0.1s linear;
        }

        .audio-time {
            font-size: 11px;
            color: #aaa;
            min-width: 35px;
            text-align: right;
            font-family: inherit;
        }

        .input-container {
            border-top: 1px solid #333;
            padding-top: 16px;
            margin-top: 8px;
            margin-bottom: 50px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .textbox-wrapper {
            flex: 1;
            position: relative;
        }

        .textbox {
            width: 100%;
            height: 44px;
            min-height: 44px;
            max-height: 44px;
            background-color: #2c2c2e;
            border: 1px solid #444;
            border-radius: 20px;
            color: white;
            font-family: inherit;
            font-size: 15px;
            line-height: 1.4;
            padding: 10px 16px;
            resize: none;
            outline: none;
            transition: border-color 0.2s;
            overflow: hidden;
            scrollbar-width: none;
            -ms-overflow-style: none;
        }

        .textbox::-webkit-scrollbar {
            display: none;
        }

        .textbox:focus {
            border-color: #0a84ff;
            outline: none;
        }

        .textbox.typing-indicator {
            background-color: #1a1a1a;
            border-color: #0a84ff;
            animation: pulse 2s infinite;
        }

        @keyframes pulse {
            0% { box-shadow: 0 0 0 0 rgba(10, 132, 255, 0.3); }
            70% { box-shadow: 0 0 0 4px rgba(10, 132, 255, 0); }
            100% { box-shadow: 0 0 0 0 rgba(10, 132, 255, 0); }
        }

        .send-button {
            width: 44px;
            height: 44px;
            background-color: #0a84ff;
            border: none;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: background-color 0.2s, opacity 0.2s;
            flex-shrink: 0;
        }

        .send-button:disabled {
            opacity: 0.5;
            cursor: default;
        }

        .send-button:not(:disabled):hover {
            background-color: #0077e6;
        }

        .send-button:not(:disabled):active {
            background-color: #0066cc;
        }

        .send-button svg {
            width: 20px;
            height: 20px;
            fill: white;
            transform: rotate(180deg);
        }

        .textbox::placeholder {
            color: #888;
            font-size: 15px;
            font-family: inherit;
        }

        /* مودال */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.65);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 2000;
            backdrop-filter: blur(2px);
        }

        .modal-overlay.hidden {
            display: none;
        }

        .modal-box {
            background: var(--panel-bg);
            border-radius: 16px;
            padding: 28px 24px 24px;
            width: 85%;
            max-width: 340px;
            text-align: center;
            color: white;
            font-family: inherit;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
            direction: rtl;
        }

        .modal-message {
            font-size: 17px;
            margin-bottom: 28px;
            line-height: 1.6;
        }

        .number-selector {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 20px;
            margin-bottom: 32px;
        }

        .number-btn {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            border: 2px solid #0a84ff;
            background-color: transparent;
            color: #0a84ff;
            font-size: 24px;
            font-weight: bold;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background-color 0.2s, color 0.2s;
            font-family: inherit;
            line-height: 1;
        }

        .number-btn:active {
            background-color: #0a84ff;
            color: white;
        }

        .number-value {
            font-size: 28px;
            font-weight: bold;
            min-width: 60px;
            text-align: center;
            color: white;
        }

        .modal-actions {
            display: flex;
            justify-content: space-around;
            gap: 16px;
        }

        .modal-action-btn {
            flex: 1;
            background-color: #0a84ff;
            color: white;
            border: none;
            border-radius: 24px;
            padding: 12px 20px;
            font-size: 16px;
            font-weight: bold;
            cursor: pointer;
            transition: background-color 0.2s, opacity 0.2s;
            font-family: inherit;
        }

        .modal-action-btn.secondary {
            background-color: #555;
        }

        .modal-action-btn:active {
            opacity: 0.85;
        }

        /* مودال نمایش تصویر پروفایل */
        .image-modal-overlay {
            position: fixed;
            inset: 0;
            background-color: rgba(0, 0, 0, 0.85);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 3000;
            padding: 20px;
        }

        .image-modal-overlay.hidden {
            display: none;
        }

        .image-modal-box {
            max-width: 95vw;
            max-height: 95vh;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .image-modal-box img {
            max-width: 80%;
            max-height: 95vh;
            border-radius: 16px;
            object-fit: contain;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
        }

        /* ===== تماس ورودی ===== */
        .call-screen {
            position: fixed;
            inset: 0;
            background: var(--app-bg);
            z-index: 10000;
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: space-between;
            padding: 56px 24px 40px;
            color: #fff;
            direction: rtl;
        }

        .call-screen.visible {
            display: flex;
        }

        .call-top {
            text-align: center;
            margin-top: 20px;
        }

        /* پالس دور آواتار */
        .call-avatar-wrap {
            position: relative;
            width: 120px;
            height: 120px;
            margin: 0 auto 14px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .call-avatar-wrap::before,
        .call-avatar-wrap::after {
            content: "";
            position: absolute;
            inset: -8px;
            border-radius: 50%;
            border: 2px solid rgba(255, 255, 255, 0.45);
            animation: avatarPulse 2.2s infinite;
        }

        .call-avatar-wrap::after {
            animation-delay: 1.1s;
        }

        @keyframes avatarPulse {
            0%   { transform: scale(0.85); opacity: 0.7; }
            70%  { transform: scale(1.45); opacity: 0; }
            100% { transform: scale(1.6); opacity: 0; }
        }

        .call-avatar {
            width: 110px;
            height: 110px;
            border-radius: 50%;
            object-fit: cover;
            border: 3px solid rgba(255,255,255,0.9);
            box-shadow: 0 8px 30px rgba(0,0,0,0.4);
            position: relative;
            z-index: 1;
        }

        .call-name {
            font-size: 30px;
            font-weight: bold;
            margin-bottom: 8px;
        }

        .call-status {
            font-size: 14px;
            color: #c9d3e0;
        }

        .swipe-answer-wrap {
            width: 100%;
            max-width: 360px;
            margin-bottom: 170px; /* بالاتر شدن محل درگ */
        }

        .swipe-answer-wrap.hide {
            opacity: 0;
            visibility: hidden;
            transition: 0.3s ease;
        }

        .swipe-track {
            width: 100%;
            height: 64px;
            border-radius: 999px;
            background: rgba(255,255,255,0.12);
            border: 1px solid rgba(255,255,255,0.18);
            position: relative;
            overflow: hidden;
            user-select: none;
            touch-action: none;
        }

        .swipe-hint {
            position: absolute;
            inset: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #d9e4f2;
            font-size: 14px;
            pointer-events: none;
        }

        .phone-knob {
            position: absolute;
            top: 6px;
            left: 6px;
            width: 52px;
            height: 52px;
            border-radius: 50%;
            background: #22c55e;
            border: none;
            box-shadow: 0 6px 20px rgba(34,197,94,0.45);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: grab;
            touch-action: none;
        }

        .phone-knob.dragging {
            cursor: grabbing;
        }

        .phone-knob svg {
            width: 24px;
            height: 24px;
            fill: #fff;
        }
		    .hidden{display:none !important;}

    .back-button{
      background:transparent;
      border:none;
      padding:10px 8px;
      cursor:pointer;
      display:flex;
      align-items:center;
      justify-content:center;
    }
    .back-button svg{width:24px;height:24px;fill:#fff}

    /* ===== Pause/Play button (moved into header) ===== */
    .header-actions{
      display:flex;
      align-items:center;
      gap:10px;
    }
    .timeline-toggle{
      position: static;
      width: 36px;
      height: 36px;
      border: none;
      border-radius: 10px;
      background: rgba(255,255,255,.10);
      color: #fff;
      font-size: 18px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .timeline-toggle:hover{ background: rgba(255,255,255,.16); }

    /* ===== مینیمال Contacts ===== */
    .contacts-screen{
      position: fixed;
      inset: 0;
      z-index: 9998;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      background: #0f1115;
    }

    .contacts-header{
      position: sticky;
      top: 0;
      z-index: 2;
      padding: 14px 16px;
      color: #fff;
      font-size: 18px;
      font-weight: 700;
      background: #151922;
      border-bottom: 1px solid rgba(255,255,255,.08);
      backdrop-filter: none;
      -webkit-backdrop-filter: none;

      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    .contacts-list{
      padding: 6px 0;
      overflow: auto;
      scrollbar-width: thin;
      scrollbar-color: rgba(255,255,255,.16) transparent;
    }
    .contacts-list::-webkit-scrollbar{width:6px}
    .contacts-list::-webkit-scrollbar-thumb{
      background: rgba(255,255,255,.16);
      border-radius: 8px;
    }
    .contacts-list::-webkit-scrollbar-track{background: transparent}

    .contact-item{
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 10px 14px;
      margin: 0;
      border-radius: 0;
      cursor: pointer;
      user-select: none;
      background: transparent;
      border: none;
      border-bottom: 1px solid rgba(255,255,255,.06);
      box-shadow: none;
      transition: background .15s ease;
    }
    .contact-item:hover{
      transform: none;
      background: rgba(255,255,255,.04);
      border-color: rgba(255,255,255,.06);
      box-shadow: none;
    }
    .contact-item:active{
      transform: none;
      background: rgba(255,255,255,.06);
    }

    .contact-left{
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
    }

    .contact-avatar{
      width: 40px;
      height: 40px;
      border-radius: 50%;
      object-fit: cover;
      flex: 0 0 40px;
      border: none;
      box-shadow: none;
    }

    .contact-meta{
      display: flex;
      flex-direction: column;
      gap: 2px;
      min-width: 0;
    }
    .contact-name{
      color: #fff;
      font-size: 14px;
      font-weight: 600;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .contact-last{
      color: rgba(230,236,255,.65);
      font-size: 12px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 62vw;
    }

    .unread-badge{
      min-width: 20px;
      height: 20px;
      padding: 0 6px;
      border-radius: 999px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 11px;
      font-weight: 700;
      color: #fff;
      background: #2f80ff;
      border: none;
      box-shadow: none;
    }
    .unread-badge.hidden{display:none}

    .contact-item.active{
      border-color: rgba(255,255,255,.06);
      box-shadow: none;
      background: rgba(255,255,255,.05);
    }

    /* Settings Icon */
    .settings-button {
      background:transparent;
      border:none;
      padding:8px;
      cursor:pointer;
      display:flex;
      align-items:center;
      justify-content:center;
      color: #fff;
      transition: color .15s ease;
    }
    .settings-button:hover{
      background: rgba(255,255,255,.16);
      border-radius: 6px;
    }
    .settings-button svg {
      width: 24px;
      height: 24px;
      fill: currentColor;
    }

    /* Modal Styles */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.6);
      z-index: 10000;
      display: flex;
      align-items: center;
      justify-content: center;
      backdrop-filter: blur(5px);
      -webkit-backdrop-filter: blur(5px);
    }
    .modal-box {
      background: #1f2733;
      padding: 20px 24px;
      border-radius: 12px;
      text-align: center;
      box-shadow: 0 8px 24px rgba(0,0,0,.2);
      width: 85%;
      max-width: 320px;
    }
    .modal-message {
      color: #fff;
      font-size: 16px;
      font-weight: 500;
      margin-bottom: 20px;
      line-height: 1.5;
    }
    .modal-actions {
      display: flex;
      justify-content: space-around;
      gap: 10px;
    }
    .modal-action-btn {
      padding: 10px 16px;
      border: none;
      border-radius: 8px;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      flex-grow: 1;
      transition: background .15s ease;
      background: #2f80ff;
      color: #fff;
    }
    .modal-action-btn:hover {
      background: #1a6fef;
    }
    .modal-action-btn.secondary {
      background: rgba(255,255,255,.1);
      color: #fff;
    }
    .modal-action-btn.secondary:hover {
      background: rgba(255,255,255,.16);
    }

    @media (max-width: 360px){
      .contact-name{font-size:13px}
      .contact-last{font-size:11.5px}
      .contact-avatar{width:36px;height:36px;flex-basis:36px}
    }
	
	.top-notif{
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 24px));
  background: rgba(20,20,20,.92);
  color: #fff;
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  z-index: 10001; /* بالاتر از pause overlay و بقیه */
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  cursor: pointer;
  user-select: none;
}

.top-notif.hidden{ display:none; }

.top-notif-avatar{
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}

.top-notif-body{ min-width: 0; }
.top-notif-title{ font-size: 14px; font-weight: 700; line-height: 1.2; }
.top-notif-text{
  font-size: 13px;
  opacity: .9;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 420px;
}