/* ---------------------------------------------------------
   Monk — Modern Clean Theme for osTicket (Stable Build)
   Version: 1.0 (Responsive + Compact Buttons Fixes)
--------------------------------------------------------- */

/* Global box-sizing reset */
*, *::before, *::after {
    box-sizing: border-box;
  }
  
  /* Variables */
  :root {
    --monk-blue: #00aeef;
    --monk-blue-dark: #0299d2;
    --text: #1b1f23;
    --card: #ffffff;
    --muted: #7a8591;
    --bg-soft: #f2f6fb;
    --radius: 12px;
    --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  }
  
  /* Reset + Base */
  html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: var(--font);
    font-size: 100%;
    color: var(--text);
  }
  
  /* Background image */
  body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url('../images/monkbg1.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0.16;
    z-index: -1;
    pointer-events: none;
  }
  
  /* Container */
  #container {
    max-width: 960px;
    margin: 32px auto;
    background: var(--card);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(4px);
    position: relative;
    z-index: 2;
    box-sizing: border-box;
  }
  
  /* Header */
  #header-logo img,
  #logo img {
    max-width: 200px !important;
    height: auto;
    display: block;
    pointer-events: none;
  }
  
  /* Navigation */
  #nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #e3e7ef;
  }
  #nav li {
    list-style: none;
  }
  #nav li a {
    padding: 8px 14px;
    border-radius: 30px;
    font-weight: 600;
    color: var(--text);
    transition: background-color 0.25s, color 0.25s;
    font-size: 15px;
  }
  #nav li a:hover,
  #nav li a.active {
    background: var(--monk-blue);
    color: #fff;
  }
  
  /* Thread Section */
  #ticketThread {
    margin-top: 20px;
    padding: 12px 0;
  }
  
  /* Thread Bubbles */
  .thread-entry {
    max-width: 85%;
    padding: 18px 20px;
    margin-bottom: 18px;
    border-radius: 14px;
    box-shadow: 0 3px 10px rgba(15, 20, 35, 0.08);
    line-height: 1.6;
    word-break: break-word;
    background: var(--card);
    color: var(--text);
  }
  
  .thread-entry.staff {
    background: #fff;
    border: 1px solid #eceff4;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    margin-right: auto;
    border-bottom-left-radius: 6px;
  }
  
  .thread-entry.user {
    background: var(--monk-blue);
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 6px;
  }
  
  .thread-entry .header {
    font-weight: 700;
    margin-bottom: 6px;
    font-size: 14px;
    color: inherit;
  }
  
  .thread-entry .message {
    font-size: 15px;
    color: inherit;
  }
  
  .thread-entry .meta {
    margin-top: 10px;
    padding-top: 8px;
    font-size: 12px;
    opacity: 0.85;
  }
  
  /* Prevent long text/table breakage */
  .thread-entry table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
  }
  .thread-entry td,
  .thread-entry th {
    word-break: break-word;
    padding: 8px;
  }
  
  /* Reply Box */
  #reply,
  textarea,
  #message,
  #response {
    width: 100%;
    font-size: 15px;
    border-radius: 10px;
    border: 1px solid #d6dce4;
    padding: 12px;
    box-shadow: none;
    background: #fff;
    max-width: 100%;
    resize: vertical;
    box-sizing: border-box;
  }
  
  /* Forms */
  input,
  select,
  textarea {
    font-family: var(--font);
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #ccd1d9;
    max-width: 400px;
    font-size: 15px;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
  }
  input:focus,
  select:focus,
  textarea:focus {
    border-color: var(--monk-blue);
    box-shadow: 0 0 6px rgba(0, 174, 239, 0.5);
    outline: none;
  }
  
  /* Buttons */
  button,
  input[type="submit"],
  .button,
  .action-button {
    font-size: 15px;
    padding: 12px 24px;
    line-height: 1.3;
    min-width: 0;
    max-width: 100%;
    border: none;
    border-radius: 10px;
    background: var(--monk-blue);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
    box-shadow: 0 4px 10px rgba(0, 174, 239, 0.3);
    box-sizing: border-box;
  }
  button:hover,
  input[type="submit"]:hover,
  .button:hover,
  .action-button:hover {
    background: var(--monk-blue-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 153, 210, 0.4);
  }
  
  /* Secondary buttons */
  .button.secondary,
  .btn-secondary {
    background: #e4e7ec;
    color: #333;
  }
  .button.secondary:hover,
  .btn-secondary:hover {
    background: #d2d6dd;
  }
  
  /* Select2 Fix */
  .select2-container {
    z-index: 999999;
  }
  .select2-dropdown {
    z-index: 9999999;
    background: #fff;
    border: 1px solid #ccd1d9;
    border-radius: 8px;
  }
  
  /* Footer */
  #footer {
    margin-top: 40px;
    text-align: center;
    font-size: 13px;
    color: #777;
  }
  
  /* ---------------------------------------------------------
     Monk — Modern Table Styling
  --------------------------------------------------------- */
  
  table {
    width: 100%;
    border-collapse: separate !important;
    border-spacing: 0;
    background: var(--card);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.06);
    margin: 20px 0;
  }
  
  /* Table header */
  table th {
    background: var(--monk-blue);
    color: #fff;
    padding: 14px 16px;
    font-weight: 600;
    text-align: left;
    font-size: 14px;
    letter-spacing: 0.3px;
  }
  
  /* Table body */
  table td {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text);
    border-bottom: 1px solid #edf0f4;
  }
  
  /* Remove border on last row */
  table tr:last-child td {
    border-bottom: none;
  }
  
  /* Row hover */
  table tbody tr:hover {
    background: rgba(0, 174, 239, 0.08);
    transition: background 0.2s ease;
  }
  
  /* Striped rows */
  table tbody tr:nth-child(even) {
    background: #f9fbfd;
  }
  
  /* Action icons inside tables */
  table td a {
    color: var(--monk-blue);
    font-weight: 600;
  }
  table td a:hover {
    color: var(--monk-blue-dark);
    text-decoration: underline;
  }
  
  /* Round top corners of header */
  table th:first-child {
    border-top-left-radius: 10px;
  }
  table th:last-child {
    border-top-right-radius: 10px;
  }
  
  /* If a table has checkboxes */
  table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
  }
  
  /* Pagination (bottom of ticket list) */
  #tickets .pagination,
  .pagination {
    margin-top: 16px;
    display: flex;
    gap: 8px;
  }
  
  .pagination a,
  .pagination span {
    padding: 8px 12px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #dcdfe6;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    font-size: 13px;
  }
  
  .pagination a:hover {
    background: var(--monk-blue);
    color: #fff;
    border-color: var(--monk-blue);
  }
  
  .pagination .active {
    background: var(--monk-blue);
    color: #fff;
    border-color: var(--monk-blue);
  }
  
  /* Status Labels */
  .status,
  .TicketStatus,
  span.ticketstatus {
    padding: 6px 12px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 12px !important;
    color: #fff !important;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.4px;
  }
  
  .status.open,
  .status.Open {
    background: #28c76f;
  }
  
  .status.closed,
  .status.Closed {
    background: #ff4c4c;
  }
  
  .status.answered,
  .status.Answered {
    background: var(--monk-blue);
  }
  
  .status.overdue,
  .status.Overdue {
    background: #ff9f43;
  }
  
  /* Modern Cards */
  .card,
  .info-box,
  .dashboard-stats,
  .ticket-info {
    background: var(--card);
    padding: 20px;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecf2;
    margin-bottom: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
  
  .card:hover,
  .info-box:hover,
  .dashboard-stats:hover,
  .ticket-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  }
  
  /* Input Labels */
  label {
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
    font-size: 14px;
    color: #333;
  }
  
  /* Headings */
  h1, h2, h3 {
    font-weight: 700;
    margin-top: 10px;
    margin-bottom: 18px;
    letter-spacing: -0.3px;
  }
  /* Smaller font size for h1 header content */
h1 {
    font-size: 1.8rem; /* smaller than default 2-2.5rem */
    line-height: 1.2;
    font-weight: 700;
    margin-bottom: 12px;
  }
  
  /* If you have buttons or links inside h1, reduce their size too */
  h1 button,
  h1 .button,
  h1 a.button {
    font-size: 0.9rem;
    padding: 6px 14px;
    min-width: auto;
    line-height: 1.2;
    border-radius: 8px;
    vertical-align: middle;
  }
  
  
  /* Horizontal Rules */
  hr {
    border: none;
    border-top: 1px solid #e3e7ef;
    margin: 24px 0;
  }
  
  /* ----------------------------------------------
     Compact Buttons for headers or tight spaces
  ------------------------------------------------*/
  #header button,
  #header input[type="submit"],
  #header .button,
  .header-button {
    padding: 6px 14px !important;
    font-size: 13px !important;
    min-width: auto !important;
    line-height: 1.2 !important;
    box-shadow: none !important;
    border-radius: 8px !important;
    background: var(--monk-blue) !important;
    color: #fff !important;
    transition: background-color 0.25s ease, transform 0.25s ease;
    cursor: pointer;
  }
  
  #header button:hover,
  #header input[type="submit"]:hover,
  #header .button:hover,
  .header-button:hover {
    background: var(--monk-blue-dark) !important;
    transform: translateY(-1px);
    box-shadow: none !important;
  }
  
  /* ----------------------------------------------
     Small action buttons and links (refresh, open, etc)
  ------------------------------------------------*/
  
  .action-button.small,
  .button.small,
  button.small,
  a.button.small,
  a.action-button.small {
    font-size: 12px !important;
    padding: 6px 12px !important;
    min-width: auto !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    line-height: 1.1 !important;
  }
  
  /* For icon-only buttons (like refresh icons) */
  .action-button.icon-only,
  .button.icon-only,
  button.icon-only {
    padding: 6px !important;
    width: 32px !important;
    height: 32px !important;
    font-size: 16px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
    box-shadow: none !important;
  }
  
  /* ----------------------------------------------
     Responsive Improvements
  ------------------------------------------------*/
  @media (max-width: 720px) {
  
    #container {
      margin: 12px;
      padding: 16px;
    }
    .thread-entry {
      max-width: 92%;
      padding: 14px 16px;
    }
  
    /* Nav smaller font & spacing */
    #nav li a {
      font-size: 13px;
      padding: 6px 10px;
    }
  
    /* Buttons scale down on small screens */
    button,
    input[type="submit"],
    .button,
    .action-button {
      font-size: 13px !important;
      padding: 10px 18px !important;
    }
  
    /* Small action buttons even smaller on mobile */
    .action-button.small,
    .button.small,
    button.small,
    a.button.small,
    a.action-button.small {
      font-size: 11px !important;
      padding: 4px 10px !important;
    }
  
    .action-button.icon-only,
    .button.icon-only,
    button.icon-only {
      width: 28px !important;
      height: 28px !important;
      font-size: 14px !important;
    }
  
    /* Make tables scroll horizontally on small screens */
    table {
      display: block;
      overflow-x: auto;
      white-space: nowrap;
    }
  
    /* Reduce input max width */
    input,
    select,
    textarea {
      max-width: 100% !important;
    }
  
    /* Container padding & margin adjustments for very small */
    #container {
      margin: 8px;
      padding: 12px;
    }
  }
  
  /* Target the specific h1 with the links and icons */
h1 {
    font-size: 1.4rem !important; /* smaller than default */
    font-weight: 700;
    margin: 10px 0 !important;
    line-height: 1.2;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  /* Style the link inside h1 */
  h1 > a {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    color: inherit;
    text-decoration: none;
  }
  
  /* Resize icon inside the link */
  h1 > a i.refresh {
    font-size: 1.2rem !important;
    vertical-align: middle;
  }
  
  /* The right side container inside h1 */
  h1 > div.pull-right.states {
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    color: #555 !important;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  
  /* Smaller icon on right side */
  h1 > div.pull-right.states i.icon-file-alt {
    font-size: 1rem !important;
    vertical-align: middle;
  }
  
  /* Style the small tag */
  h1 > div.pull-right.states small {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
  }
  
  /* Style the link inside the small */
  h1 > div.pull-right.states a.state.active {
    color: var(--monk-blue) !important;
    text-decoration: none;
    font-weight: 600 !important;
  }
  
  /* Optional: reduce padding/margin inside */
  h1 > a,
  h1 > div.pull-right.states {
    margin: 0;
    padding: 0;
  }
  