<!DOCTYPE html>
<html>
<head>
  <title>Shareable</title>
  <meta charset="UTF-8">
  <style>
    body {
      width: 300px;
      padding: 15px;
      background-color: #1a1a1a;
      color: white;
      font-family: Arial, sans-serif;
      margin: 0;
    }

    .main-buttons {
      display: flex;
      flex-direction: column;
      gap: 15px;
      margin-bottom: 15px;
    }

    #logoutBtn {
      width: 100%;
      padding: 10px;
      border: none;
      border-radius: 4px;
      cursor: pointer;
      color: white;
      background-color: #f44336;
      transition: background-color 0.3s ease;
    }

    #logoutBtn:hover {
      background-color: #d32f2f;
    }

    #shareBtn {
      width: 100%;
      padding: 10px;
      border: none;
      border-radius: 4px;
      cursor: pointer;
      color: white;
      background-color: #2196F3;
      transition: background-color 0.3s ease;
    }

    #shareBtn:hover {
      background-color: #1976D2;
    }

    .share-form {
      display: none;
      padding: 15px;
      background-color: #262626;
      border-radius: 8px;
      margin-bottom: 15px;
    }

    .share-form.active {
      display: block;
    }

    .form-group {
      margin-bottom: 15px;
    }

    .form-group label {
      display: block;
      margin-bottom: 5px;
      color: #ddd;
    }

    .form-group input {
      width: 100%;
      padding: 8px;
      border: 1px solid #444;
      border-radius: 4px;
      background-color: #333;
      color: white;
      box-sizing: border-box;
    }

    .form-group input:disabled {
      background-color: #2a2a2a;
      cursor: not-allowed;
    }

    .time-options {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-bottom: 15px;
    }

    .time-option {
      flex: 1 0 calc(50% - 4px);
      padding: 8px;
      border: none;
      border-radius: 4px;
      cursor: pointer;
      background-color: #333;
      color: white;
      transition: background-color 0.3s ease;
    }

    .time-option.selected {
      background-color: #2196F3;
    }

    .time-option:hover {
      background-color: #444;
    }

    #submitShare {
      width: 100%;
      padding: 10px;
      border: none;
      border-radius: 4px;
      cursor: pointer;
      color: white;
      background-color: #4CAF50;
      transition: background-color 0.3s ease;
    }

    #submitShare:hover {
      background-color: #388E3C;
    }

    .shared-buttons-container {
      display: flex;
      flex-direction: column;
      gap: 10px;
      margin-bottom: 15px;
    }

    .import-button {
      width: 100%;
      padding: 10px;
      border: none;
      border-radius: 4px;
      cursor: pointer;
      color: white;
      background-color: #4CAF50;
      transition: background-color 0.3s ease;
    }

    .import-button:hover {
      background-color: #FFD700;
      color: #000;
    }

    .key-input-modal {
      display: none;
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      background-color: #333;
      padding: 20px;
      border-radius: 8px;
      z-index: 1000;
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    }

    .key-input-modal.active {
      display: block;
    }

    .modal-overlay {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-color: rgba(0, 0, 0, 0.5);
      z-index: 999;
    }

    .modal-overlay.active {
      display: block;
    }

    .toast {
      visibility: hidden;
      min-width: 200px;
      background-color: #333;
      color: white;
      text-align: center;
      border-radius: 6px;
      padding: 12px;
      position: fixed;
      z-index: 1000;
      left: 50%;
      transform: translateX(-50%);
      bottom: 30px;
      font-size: 14px;
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
      opacity: 0;
      transition: opacity 0.3s, visibility 0.3s;
    }

    .toast.show {
      visibility: visible;
      opacity: 1;
      animation: fadeInOut 3s ease;
    }

    .toast.error {
      background-color: #f44336;
    }

    @keyframes fadeInOut {
      0% { opacity: 0; }
      10% { opacity: 1; }
      90% { opacity: 1; }
      100% { opacity: 0; }
    }

    .glowing-text {
      text-align: center;
      margin: 15px;
      color: white;
      font-size: 13px;
      animation: glow 2s ease-in-out infinite;
    }

    @keyframes glow {
      0%, 100% { text-shadow: 0 0 5px #2196F3; }
      50% { text-shadow: 0 0 20px #2196F3; }
    }

    #reloadBtn {
      position: fixed;
      bottom: 10px;
      right: 10px;
      width: 30px;
      height: 30px;
      border-radius: 50%;
      background-color: #2196F3;
      color: white;
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      transition: transform 0.3s ease;
      padding: 0;
      line-height: 1;
    }

    #reloadBtn:hover {
      transform: rotate(180deg);
    }
  </style>
</head>
<body>
  <div class="main-buttons">
    <button id="logoutBtn">Logout</button>
    <button id="shareBtn">Share</button>
  </div>

  <div class="share-form" id="shareForm">
    <div class="form-group">
      <label for="shareName">Your Name</label>
      <input type="text" id="shareName" placeholder="Enter your name" maxlength="20">
    </div>

    <div class="form-group">
      <label for="domain">Domain</label>
      <input type="text" id="domain" disabled>
    </div>

    <div class="form-group">
      <label>Share Duration</label>
      <div class="time-options">
        <button class="time-option" data-days="5m">5 Minutes</button>
        <button class="time-option" data-days="1hr">1 Hour</button>
        <button class="time-option" data-days="1d">1 Day</button>
        <button class="time-option" data-days="7">7 Days</button>
        <button class="time-option" data-days="14">14 Days</button>
        <button class="time-option" data-days="30">30 Days</button>
      </div>
    </div>

    <div class="form-group">
      <label for="shareKey">Access Key (5-12 characters)</label>
      <input type="text" id="shareKey" placeholder="Enter access key" minlength="5" maxlength="12">
    </div>

    <button id="submitShare">Submit</button>
  </div>

  <div class="shared-buttons-container" id="sharedButtonsContainer">
    <!-- Shared buttons will be dynamically inserted here -->
  </div>

  <div class="modal-overlay" id="modalOverlay"></div>
  <div class="key-input-modal" id="keyInputModal">
    <div class="form-group">
      <label for="accessKey">Enter Access Key</label>
      <input type="text" id="accessKey" placeholder="Enter access key">
    </div>
    <button id="submitKey" class="import-button">Login</button>
  </div>

  <div id="customText" class="glowing-text"></div>
  <div id="toast" class="toast"></div>
  <button id="reloadBtn" title="Reload">&#8635;</button>

  <script src="popup.js"></script>
</body>
</html>