@import url('https://fonts.googleapis.com/css2?family=Cairo&display=swap');
    * {
      box-sizing: border-box;
    }
    body {
      margin: 0;
      font-family: 'Cairo', sans-serif;
      background: #fefefe;
      color: #222;
      min-height: 100vh;
      display: flex;
      justify-content: center;
      align-items: flex-start;
      padding: 2rem;
      direction: rtl;
    }
    #app {
      background: #fff;
      width: 100%;
      max-width: 1100px;
      border-radius: 20px;
      box-shadow:
        0 12px 30px rgba(170, 170, 170, 0.3),
        inset 0 0 40px #a0a0a0aa;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      animation: fadeInUp 1s ease forwards;
      max-height: 96vh;
      position: relative;
    }
    header {
      background: linear-gradient(90deg, #4a90e2, #50d2c2);
      color: white;
      font-weight: 900;
      font-size: 2.4rem;
      text-align: center;
      padding: 25px 0 10px 0;
      letter-spacing: 0.12em;
      user-select: none;
      border-radius: 20px 20px 0 0;
      position: relative;
    }
    .marquee-container {
      overflow: hidden;
      white-space: nowrap;
      width: 100%;
      box-sizing: border-box;
      border-top: 1px solid rgba(255, 255, 255, 0.25);
      padding-top: 8px;
      height: 24px;
      user-select: none;
    }
    .marquee-text {
      display: inline-block;
      padding-left: 100%;
      animation: marquee-left 15s linear infinite;
      font-size: 1rem;
      font-weight: 600;
      color: #d0d0ffaa;
      user-select: none;
      line-height: 24px;
    }
    @keyframes marquee-left {
      from {
        transform: translateX(0);
      }
      to {
        transform: translateX(-100%);
      }
    }
    main {
      flex: 1;
      padding: 2rem 3rem;
      display: flex;
      flex-direction: column;
      overflow-y: auto;
    }
    .login-section, .dashboard {
      max-width: 480px;
      margin: 0 auto;
      display: flex;
      flex-direction: column;
      gap: 1rem;
    }
    label {
      font-size: 1.3rem;
      color: #21707b;
      font-weight: 700;
      margin-bottom: .4rem;
      display: block;
    }
    select, input[type="text"], input[type="username"], input[type="name"], input[type="password"], input[type="date"], textarea, input[type="file"] {
      width: 100%;
      font-size: 1.1rem;
      padding: 10px 15px;
      border: 1.8px solid #a5d4db;
      border-radius: 12px;
      background: #f7fbfc;
      box-shadow: inset 0 3px 8px #cde5eb;
      outline: none;
      box-sizing: border-box;
      transition: background .3s, border-color .3s;
    }
    select:hover, select:focus,
    input[type="text"]:hover, input[type="text"]:focus,
    input[type="password"]:hover, input[type="password"]:focus,
    input[type="date"]:hover, input[type="date"]:focus,
    textarea:hover, textarea:focus,
    input[type="file"]:hover, input[type="file"]:focus {
      border-color: #50d2c2;
      background: #d0e9ef;
    }
    textarea {
      min-height: 110px;
      resize: vertical;
    }
    .login-section button,
    .dashboard button[type="submit"],
    #change-password-btn,
    #logout-btn {
      padding: 12px 22px;
      font-size: 1.4rem;
      font-weight: 900;
      border-radius: 15px;
      border: none;
      cursor: pointer;
      background: #4a7aff;
      color: #fff;
      box-shadow: 0 0 22px #709bfa;
      transition: background .3s, box-shadow .3s;
      width: 100%;
      max-width: 480px;
      user-select: none;
    }
    .login-section button:disabled,
    .dashboard button[type="submit"]:disabled {
      background: #a1a8ff7a;
      box-shadow: none;
      cursor: not-allowed;
    }
    .login-section button:hover:not(:disabled),
    .dashboard button[type="submit"]:hover:not(:disabled),
    #change-password-btn:hover,
    #logout-btn:hover {
      background: #2547bd;
      box-shadow: 0 0 28px #548fff;
    }
    #change-password-btn {
      background: none;
      border: none;
      color: #4a7aff;
      text-align: left;
      font-weight: 800;
      text-decoration: underline;
      margin: 0;
      padding: 0;
      width: max-content;
      cursor: pointer;
    }
    #change-password-btn:hover {
      color: #2547bd;
    }
    #logout-btn {
      background: transparent;
      color: #4a7aff;
      max-width: 120px;
    }
    #search-input {
      margin: 15px 0 20px;
    }
    form {
      margin-bottom: 0;
    }
    #book-list {
      max-height: 40vh;
      background: #f0f6ff;
      border-radius: 15px;
      padding: 20px;
      box-shadow: inset 0 0 35px #7e94fa88;
      overflow-y: auto;
      font-size: 1.1rem;
      color: #3f51b5;
    }
    .book-card {
      background: #a1b3fbe0;
      padding: 15px 20px;
      border-radius: 15px;
      margin-bottom: 12px;
      box-shadow: 0 10px 26px #869afba9;
      position: relative;
      user-select: none;
      transition: all 0.3s ease;
    }
    .book-card:hover {
      background: #798cfa;
      box-shadow: 0 12px 32px #6479ddaa;
      color: white;
    }

    /* العرض المضغوط للكتب */
    .book-card.compact {
      padding: 10px 15px;
      margin-bottom: 8px;
    }

    .book-compact-view {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 15px;
    }

    .book-number-compact {
      font-size: 1.1rem;
      font-weight: 700;
      color: #3f51b5;
      flex-grow: 1;
    }

    .book-card.compact:hover .book-number-compact {
      color: white;
    }

    .book-details {
      margin-top: 15px;
      animation: fadeIn 0.3s ease;
    }

    @keyframes fadeIn {
      from {
        opacity: 0;
        transform: translateY(-10px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }
    .book-info-header {
      display: flex;
      font-size: 0.95rem;
      font-style: italic;
      color: #cad5fbcc;
      margin-bottom: 12px;
      gap: 20px;
    }
    .book-header {
      font-weight: 900;
      font-size: 1.4rem;
      margin-bottom: 10px;
      color: inherit;
    }
    .book-department {
      font-weight: 700;
      font-size: 1.1rem;
      margin-bottom: 10px;
      color: #c2cff9;
    }
    .book-content {
      line-height: 1.4;
      white-space: pre-wrap;
    }
    .book-attachment {
      font-weight: 700;
      text-decoration: underline;
      cursor: pointer;
      margin-top: 8px;
      display: inline-block;
    }
    .book-attachment:hover {
      color: #aab8ff;
    }
    button.send-btn,
    button.send-file-btn,
    button.preview-btn {
      position: absolute;
      top: 20px;
      border-radius: 12px;
      padding: 5px 14px;
      font-weight: 700;
      font-size: 0.95rem;
      cursor: pointer;
      border: none;
      color: white;
      user-select: none;
      transition: background 0.3s ease;
    }
    button.send-btn {
      left: 125px;
      background-color: #5847b0;
      box-shadow: 0 0 15px #736ceaaa;
    }
    button.send-file-btn {
      left: 15px;
      background-color: #2c54ae;
      box-shadow: 0 0 15px #5574ffab;
    }
    button.preview-btn {
      left: 218px;
      background-color: #3060f7;
      box-shadow: 0 0 15px #4e7fffaa;
    }
    button.send-btn:hover {
      background-color: #3b35a2;
    }
    button.send-file-btn:hover {
      background-color: #233d8c;
    }
    button.preview-btn:hover {
      background-color: #1c45c2;
    }
    /* مودال تغيير كلمة المرور */
    #change-password-modal {
      display: none;
      position: fixed;
      z-index: 9999;
      left: 0; top: 0; right: 0; bottom: 0;
      background: rgba(0,0,0,0.5);
      justify-content: center;
      align-items: center;
      font-family: 'Cairo', sans-serif;
    }
    #change-password-modal.active {
      display: flex;
    }
    #change-password-modal .modal-content {
      background: white;
      border-radius: 18px;
      padding: 2rem 2.5rem;
      width: 100%;
      max-width: 400px;
      box-shadow: 0 12px 40px #4558ff71;
      display: flex;
      flex-direction: column;
      gap: 1.2rem;
    }
    #change-password-modal h2 {
      margin: 0 0 1rem 0;
      font-weight: 900;
      color: #4a7aff;
      text-align: center;
      font-size: 1.8rem;
    }
    #change-password-modal label {
      margin-bottom: .2rem;
    }
    #change-password-modal input[type="password"] {
      font-size: 1.1rem;
      padding: 10px 15px;
    }
    #change-password-modal .error-message {
      color: #c02c2c;
      font-size: 0.9rem;
      min-height: 18px;
      user-select: none;
      direction: rtl;
    }
    #change-password-modal button {
      background: #4a7aff;
      color: white;
      font-weight: 900;
      border-radius: 10px;
      border: none;
      padding: 11px 0;
      font-size: 1.2rem;
      cursor: pointer;
      box-shadow: 0 0 28px #365bd0;
      transition: background 0.3s ease, box-shadow 0.3s ease;
      user-select: none;
    }
    #change-password-modal button:hover:not(:disabled) {
      background: #2547bd;
      box-shadow: 0 0 35px #2547bdcc;
    }
    #change-password-modal button:disabled {
      background: #8ea8ff80;
      box-shadow: none;
      cursor: not-allowed;
    }
    #change-password-modal .close-btn {
      background: transparent;
      color: #4a7aff;
      font-weight: 700;
      font-size: 1.4rem;
      text-align: center;
      cursor: pointer;
      user-select: none;
      margin-bottom: 4px;
      border: none;
      padding: 0;
      align-self: flex-end;
    }
    #change-password-modal .close-btn:hover {
      color: #2547bd;
    }

    /* زر الكتب الواردة النحيف */
    .btn-incoming-slim {
      width: 100%;
      padding: 3px 15px;
      background: linear-gradient(135deg, #ff9500, #ffb347);
      color: white;
      border: none;
      border-radius: 4px;
      font-size: 11px;
      font-weight: 500;
      text-align: center;
      cursor: pointer;
      transition: all 0.3s ease;
      box-shadow: 0 1px 4px rgba(255, 149, 0, 0.2);
      margin: 2px 0;
      height: 24px;
    }

    .btn-incoming-slim:hover {
      background: linear-gradient(135deg, #e67e00, #ff9500);
      transform: translateY(-0.5px);
      box-shadow: 0 2px 8px rgba(255, 149, 0, 0.3);
      color: white;
    }

    .btn-incoming-slim:active {
      transform: translateY(0);
      box-shadow: 0 1px 3px rgba(255, 149, 0, 0.2);
    }
    /* مودال ارسال الملف */
    #send-file-modal {
      display: none;
      position: fixed;
      z-index: 10000;
      left: 0; top: 0; right: 0; bottom: 0;
      background: rgba(0,0,0,0.5);
      justify-content: center;
      align-items: center;
      font-family: 'Cairo', sans-serif;
      overflow: auto;
      padding: 1rem;
    }
    #send-file-modal.active {
      display: flex;
    }
    #send-file-modal .modal-content {
      background: white;
      border-radius: 18px;
      padding: 1.5rem 2rem;
      width: 100%;
      max-width: 400px;
      box-shadow: 0 12px 40px #4558ff71;
      display: flex;
      flex-direction: column;
      gap: 1rem;
      max-height: 90vh;
      overflow: auto;
    }
    #send-file-modal h2 {
      margin: 0 0 1rem 0;
      font-weight: 900;
      color: #4a7aff;
      text-align: center;
      font-size: 1.6rem;
    }
    #send-file-modal .user-list {
      flex-grow: 1;
      overflow-y: auto;
      border: 1px solid #a5d4db;
      border-radius: 12px;
      padding: 10px;
      max-height: 250px;
    }
    #send-file-modal label.checkbox-label {
      display: flex;
      align-items: center;
      margin-bottom: 0.7rem;
      cursor: pointer;
      user-select: none;
      font-size: 1.1rem;
      color: #21707b;
      font-weight: 600;
    }
    #send-file-modal label.checkbox-label input[type="checkbox"] {
      margin-left: 10px;
      transform: scale(1.25);
      cursor: pointer;
    }
    #send-file-modal button {
      padding: 10px 0;
      font-weight: 900;
      font-size: 1.2rem;
      border-radius: 12px;
      border: none;
      cursor: pointer;
      user-select: none;
      box-shadow: 0 0 22px #709bfa;
      background: #4a7aff;
      color: white;
      transition: background 0.3s ease, box-shadow 0.3s ease;
    }
    #send-file-modal button:hover:not(:disabled) {
      background: #2547bd;
      box-shadow: 0 0 28px #2547bdcc;
    }
    #send-file-modal button:disabled {
      background: #a1a8ff7a;
      box-shadow: none;
      cursor: not-allowed;
    }
    #send-file-modal .close-btn {
      background: transparent;
      color: #4a7aff;
      font-weight: 700;
      font-size: 1.5rem;
      text-align: center;
      cursor: pointer;
      user-select: none;
      margin-bottom: 0.5rem;
      border: none;
      padding: 0;
      align-self: flex-end;
    }
    #send-file-modal .close-btn:hover {
      color: #2547bd;
    }