:root {
    --primary: #0061fe;
    --primary-light: #4d8ffe;
    --success: #00c851;
    --warning: #ffbb33;
    --danger: #ff4444;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-800: #343a40;
    --border-radius: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    direction: rtl;
    text-align: right;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-300);
}

.app-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-title svg {
    color: var(--primary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-direction: row-reverse;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
}

#user-email {
    font-size: 0.85rem;
    color: var(--gray-800);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
}

.tabs-container {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-300);
}

.tab-item {
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--gray-800);
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
}

.tab-item:hover {
    color: var(--primary);
}

.tab-item.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.tab-item svg {
    width: 18px;
    height: 18px;
    margin-left: 0.25rem;
    margin-right: 0;
}

.upload-area {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.drag-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--border-radius);
    padding: 1rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.drag-area:hover, .drag-area.active {
    border-color: var(--primary);
    background-color: rgba(0, 97, 254, 0.03);
}

.drag-area h3 {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.drag-area p {
    color: var(--gray-800);
    margin-bottom: 1rem;
}

.upload-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.browse-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.browse-btn:hover {
    background-color: var(--primary-light);
}

.file-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.activity-section {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.section-header {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0px 10px 0px 25px;
}

.section-header h3 {
    font-size: 1.1rem;
    font-weight: 500;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--border-radius);
    background-color: var(--gray-100);
    position: relative;
    flex-direction: row-reverse;
}

.file-icon {
    background-color: var(--gray-200);
    width: 40px;
    height: 50px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    position: relative;
}

.file-icon:after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 15px;
    height: 15px;
    background-color: white;
    clip-path: polygon(0 0, 0% 100%, 100% 0);
}

.file-details {
    flex: 1;
}

.file-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--gray-800);
}

.file-size {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.file-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: auto;
    margin-left: 0;
    font-size: 0.8rem;
}

.progress-container {
    height: 4px;
    background-color: var(--gray-300);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--primary);
    transition: width 0.3s ease;
}

.encryption-progress {
    background-color: var(--warning);
}

.upload-progress {
    background-color: var(--primary);
}

.stages {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
    font-size: 0.75rem;
}

.stage {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--gray-800);
}

.stage-active {
    font-weight: 500;
    color: var(--primary);
}

.stage-complete {
    color: var(--success);
}

.spinner {
    display: inline-flex;
    margin-right: 5px;
    animation: spin 1.5s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner-icon {
    width: 14px;
    height: 14px;
}

.separator {
    color: var(--gray-400);
}

.file-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    color: var(--primary);
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--gray-800);
}

.empty-icon {
    font-size: 3rem;
    color: var(--gray-400);
    margin-bottom: 1rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-primary {
    background-color: rgba(0, 97, 254, 0.1);
    color: var(--primary);
}

.badge-success {
    background-color: rgba(0, 200, 81, 0.1);
    color: var(--success);
}

.badge-warning {
    background-color: rgba(255, 187, 51, 0.1);
    color: var(--warning);
}

.badge-danger {
    background-color: rgba(255, 68, 68, 0.1);
    color: var(--danger);
}

.summary {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.summary-item {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 1rem;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
}

.summary-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.summary-icon-success {
    background-color: var(--success);
}

.summary-icon-warning {
    background-color: var(--warning);
}

.summary-icon-error {
    background-color: var(--danger);
}

.summary-info h4 {
    font-size: 0.85rem;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.summary-info p {
    font-size: 1.5rem;
    font-weight: 600;
}

.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f7fa;
    z-index: 1000;
}

.login-card {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.login-card h2 {
    margin: 1.5rem 0 1rem;
    color: #333;
}

.login-message {
    color: var(--gray-800);
    margin-bottom: 1.5rem;
}

.google-signin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem;
    background-color: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.google-signin-btn svg {
    margin-left: 0.25rem;
    margin-right: 0;
}

.google-signin-btn:hover {
    background-color: var(--gray-100);
}

.login-footer {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--gray-800);
}

.toast {
    position: fixed;
    bottom: 5rem;
    left: 50%;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    display: none;
    z-index: 1000;
    max-width: 350px;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast-icon {
    flex-shrink: 0;
}

.toast-icon.error {
    color: var(--danger);
}

.toast-message {
    font-size: 0.9rem;
}

.licenses-area {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.form-section {
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background-color: white; /* Ensure background is white, not gray-100 */
}
.license-tables-container {
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background-color: white;
}

.licenses-table th:nth-child(6),
.licenses-table th:nth-child(7) {
  min-width: 115px;
}

.license-form {
    width: 100%;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-control {
    padding: 0.6rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-300);
    font-size: 0.9rem;
    width: 100%;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 97, 254, 0.1);
}

/* Multi-select specific styling */
.form-control[multiple] {
    padding: 0.4rem;
}

.form-control[multiple] option {
    border-radius: 4px;
    margin: 1px 0;
}

.form-control[multiple] option:checked {
    background-color: var(--primary);
    color: white;
}

.form-text {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
    font-style: italic;
}

.form-actions {
    display: flex;
    align-items: center;
}

.action-btn-regular {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.15rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 2px;
}

.action-btn-regular:hover {
    background-color: var(--primary-light);
}

.action-btn-regular:disabled {
    background-color: var(--gray-400);
    cursor: not-allowed;
}

/* .licenses-table-container,
.existing-licenses-container {
    margin-bottom: 2rem;
} */
/* .licenses-table-container,
.existing-licenses-container {
  background-color: transparent;
  box-shadow: none;
  margin-bottom: 1rem;
  padding: 0;
} */


.licenses-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.licenses-table th,
.licenses-table td {
    text-align: right;
    padding: 0.1rem 0.1rem;
    border-bottom: 1px solid var(--gray-300);
}

.licenses-table th {
    background-color: var(--gray-100);
    font-weight: 500;
    color: var(--gray-800);
}

.licenses-table tr:last-child td {
    border-bottom: none;
}

.licenses-table tbody tr:hover {
    background-color: var(--gray-100);
}

.empty-row td {
    text-align: center;
    color: var(--gray-800);
    padding: 2rem 1rem;
}

.action-link {
    color: var(--primary);
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.action-link:hover {
    text-decoration: underline;
}

.primary-btn,
.secondary-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);

}

.primary-btn {
    background-color: var(--primary);
    color: white;
}

.primary-btn:hover {
    background-color: var(--primary-light);
}

.primary-btn:disabled {
    background-color: var(--gray-400);
    cursor: not-allowed;
}

.secondary-btn {
    background-color: var(--gray-200);
    color: var(--gray-800);
}

.secondary-btn:hover {
    background-color: var(--gray-300);
}

.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--gray-800);
}

.spinner-large {
    animation: spin 1.5s linear infinite;
    width: 30px;
    height: 30px;
    margin-bottom: 1rem;
    color: var(--primary);
}

.delete-btn {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0.25rem;
    border-radius: 50%;
    transition: var(--transition);
}

.delete-btn:hover {
    background-color: rgba(255, 68, 68, 0.1);
}

.form-container {
    display: flex;
    gap: 1.5rem;
}

.form-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-actions {
    margin-top: auto;
    align-self: flex-end;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .form-row {
        flex-direction: column;
        gap: 1rem;
    }

    .upload-area, .activity-section {
        padding: 1rem;
    }

    .drag-area {
        padding: 2rem 1rem;
    }

    .summary {
        flex-direction: column;
    }

    .file-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .file-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .file-status {
        margin-right: 0;
        margin-left: auto;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .user-profile {
        width: 100%;
        justify-content: space-between;
    }

    .cancel-btn {
        position: absolute;
        left: 1rem;
        right: auto;
    }

    .progress-container {
        width: 100%;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .licenses-table {
        display: block;
        overflow-x: auto;
    }
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
  }

  .modal-content {
    background-color: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    direction: rtl;
  }

  .modal-header {
    padding: 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .modal-body {
    padding: 16px;
    margin-right: 10px;
  }

  .modal-footer {
    padding: 16px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-start;
    gap: 10px;
  }

  .modal-close {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
  }

  .modal-close:hover {
    color: #777;
  }

  /* Button styles if you don't already have them */
  .btn {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 500;
  }

  .btn-primary {
    background-color: var(--primary);
    color: white;
  }

  .btn-secondary {
    background-color: #eee;
    color: #333;
  }

  .btn:hover {
    opacity: 0.9;
  }


  .existing-licenses-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
  }

  .existing-licenses-table thead {
    position: sticky;
    top: 0;
    background-color: #f5f5f5; /* Match your design's header background */
    z-index: 1;
  }

  .existing-licenses-table tbody {
    display: block;
    height: 250px; /* Set your desired fixed height here */
    overflow-y: auto;
    overflow-x: hidden;
  }

  .existing-licenses-table thead tr {
    display: table;
    width: 100%;
    table-layout: fixed;
  }

  .existing-licenses-table tbody tr {
    display: table;
    width: 100%;
    table-layout: fixed;
  }

  /* Column width adjustments */
  .existing-licenses-table th:nth-child(1),
  .existing-licenses-table td:nth-child(1) {
    width: 55px; 
  }

  .existing-licenses-table th:nth-child(2),
  .existing-licenses-table td:nth-child(2){
    width: 100px; 
  }
  .existing-licenses-table th:nth-child(3),
  .existing-licenses-table td:nth-child(3){
    width: 100px;
  }
  .existing-licenses-table th:nth-child(4),
  .existing-licenses-table td:nth-child(4) {
    width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }


  .existing-licenses-table th:nth-child(5),
  .existing-licenses-table td:nth-child(5){
    word-break: break-word;
    width: 160px;
  }

  /* .existing-licenses-table th:nth-child(6),
  .existing-licenses-table td:nth-child(6)
  .existing-licenses-table th:nth-child(7),
  .existing-licenses-table td:nth-child(7)

  .existing-licenses-table th:nth-child(8),
  .existing-licenses-table td:nth-child(8),
  .existing-licenses-table th:nth-child(9),
  .existing-licenses-table td:nth-child(9) */

  .existing-licenses-table th:nth-child(10),
  .existing-licenses-table td:nth-child(10) {
    width: 30px;
  }

  /* Cell text overflow handling */
  .existing-licenses-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 8px;
  }

  /* Allow email column to wrap if needed */
  .existing-licenses-table td:nth-child(4) {
    white-space: normal;
  }

  /* Optional: Add some styles to make the scrollbar look better */
  .existing-licenses-table tbody::-webkit-scrollbar {
    width: 8px;
  }

  .existing-licenses-table tbody::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
  }

  .existing-licenses-table tbody::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
  }

  .existing-licenses-table tbody::-webkit-scrollbar-thumb:hover {
    background: #555;
  }

  /* Make sure the link icon cell is centered */
  .existing-licenses-table td.link-cell {
    text-align: center;
    padding: 0;
    vertical-align: middle;
  }

  .link-icon {
    cursor: pointer;
    transition: opacity 0.2s;
  }

  .link-icon:hover {
    opacity: 0.7;
  }

  .link-cell {
    position: relative;
  }

  .copy-message {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    white-space: nowrap;
  }

  .copy-message.show {
    opacity: 1;
  }

  /* Styles for the display-licenses-tab */
.display-licenses-area {
    background-color: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.filter-section {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.filter-form {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.filter-form .form-group {
    flex: 1;
    min-width: 150px;
}

.filter-form .form-group:last-child {
    flex: 0;
    min-width: auto;
    display: flex;
    align-items: flex-start;
}

.filter-form .form-group:last-child button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: auto;
    margin-top: 10px;
}

/* Responsive styles for smaller screens */
@media (max-width: 768px) {
    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-form .form-group:last-child {
        align-items: stretch;
    }
    
    .filter-form .form-group:last-child button {
        height: auto;
        min-height: 44px;
    }
}

/* PDF Viewer Styles */
.viewer-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.viewer-toolbar {
    padding: 10px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toolbar-button {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.toolbar-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Special styling for the open viewer button */
#open-viewer {
    background: #007bff;
    color: white;
    border-color: #007bff;
    font-weight: 500;
    gap: 5px;
}

#open-viewer:hover:not(:disabled) {
    background: #0056b3;
    border-color: #0056b3;
}

#open-viewer:disabled {
    background: #6c757d;
    border-color: #6c757d;
    color: #dee2e6;
}

.pdf-viewer {
    flex: 1;
    overflow: auto;
    /* background: #525659; */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.loading-message,
.error-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px;
    border-radius: 4px;
    display: none;
}

.error-message {
    background: rgba(220, 53, 69, 0.8);
}/* User Management Styles */
.user-management-area {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.add-user-form {
    background-color: var(--gray-100);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.add-user-form h3 {
    margin-bottom: 1rem;
    color: var(--gray-800);
    font-size: 1.2rem;
    font-weight: 600;
}

.add-user-form .form-container {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 2fr 1fr;
    gap: 1rem;
    align-items: end;
}

.add-user-form .form-group {
    display: flex;
    flex-direction: column;
}

.add-user-form .form-group label {
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-800);
}

.add-user-form .form-control {
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.add-user-form .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 97, 254, 0.1);
}

.users-table-container {
    margin-top: 2rem;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.users-table th,
.users-table td {
    padding: 0.75rem 1rem;
    text-align: right;
    border-bottom: 1px solid var(--gray-200);
}

.users-table th {
    background-color: var(--gray-100);
    font-weight: 600;
    color: var(--gray-800);
    position: sticky;
    top: 0;
    z-index: 10;
}

.users-table tbody tr:hover {
    background-color: var(--gray-100);
}

.users-table .empty-row td {
    text-align: center;
    color: var(--gray-800);
    font-style: italic;
    padding: 2rem;
}

.role-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.role-badge.role-admin {
    background-color: #e3f2fd;
    color: #1976d2;
}

.role-badge.role-publisher {
    background-color: #f3e5f5;
    color: #7b1fa2;
}

.actions-cell {
    width: 100px;
    text-align: center;
}

.actions-cell button {
    background: none;
    border: none;
    padding: 0.5rem;
    margin: 0 0.25rem;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.edit-user-btn {
    color: var(--primary);
}

.edit-user-btn:hover {
    background-color: rgba(0, 97, 254, 0.1);
}

.delete-user-btn {
    color: var(--danger);
}

.delete-user-btn:hover {
    background-color: rgba(255, 68, 68, 0.1);
}

/* Modal Styles for User Management */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
    margin: 0;
    color: var(--gray-800);
    font-size: 1.3rem;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-800);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: var(--transition);
}

.close-modal:hover {
    background-color: var(--gray-100);
}

.modal-body {
    padding: 1.5rem;
}

.modal-body .form-group {
    margin-bottom: 1rem;
}

.modal-body .form-group:last-child {
    margin-bottom: 0;
}

.modal-body label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-800);
}

.modal-body .form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.modal-body .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 97, 254, 0.1);
}

.modal-body .form-control[readonly] {
    background-color: var(--gray-100);
    color: var(--gray-800);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

.modal-footer button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.primary-btn {
    background-color: var(--primary);
    color: white;
}

.primary-btn:hover {
    background-color: var(--primary-light);
}

.primary-btn:disabled {
    background-color: var(--gray-400);
    cursor: not-allowed;
}

.secondary-btn {
    background-color: var(--gray-200);
    color: var(--gray-800);
}

.secondary-btn:hover {
    background-color: var(--gray-300);
}

/* Responsive design for user management */
@media (max-width: 768px) {
    .add-user-form .form-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .users-table {
        font-size: 0.8rem;
    }
    
    .users-table th,
    .users-table td {
        padding: 0.5rem;
    }
    
    /* Hide less important columns on mobile */
    .users-table th:nth-child(4),
    .users-table td:nth-child(4),
    .users-table th:nth-child(5),
    .users-table td:nth-child(5) {
        display: none;
    }
    
    .actions-cell button {
        padding: 0.25rem;
        margin: 0 0.1rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
}

/* Spinner styles for user management */
.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--gray-800);
}

.spinner-large {
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Pagination styles (if not already defined) */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 15px 0;
    gap: 10px;
}

.pagination-btn {
    padding: 5px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: var(--transition);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn:hover:not(:disabled) {
    background-color: #e9ecef;
}

.pagination-btn.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-buttons {
    display: flex;
    gap: 5px;
}

.page-info {
    margin: 0 10px;
    font-size: 0.9rem;
    color: var(--gray-800);
}

/* Multi-Select Dropdown Styles */
.multiselect-container {
    position: relative;
    width: 100%;
}

.multiselect-input {
    /* padding: 4px 35px 4px 0px; */
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    text-decoration: none !important;
    outline: none !important;
}

.multiselect-input:hover {
    border-color: #d1d5db;
    background: #fff;
    text-decoration: none !important;
}

.multiselect-input.active {
    border-color: #d1d5db;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(209, 213, 219, 0.1);
    text-decoration: none !important;
}

.search-input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    flex: 1;
    min-width: 120px;
    padding: 4px 0;
}

/* .selected-tag {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: tagAppear 0.2s ease;
    max-width: calc(100% - 60px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
} */

@keyframes tagAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.selected-tag {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: tagAppear 0.2s ease;
    flex-wrap: wrap-reverse;
    min-width: 80px;              /* Ensure minimum width for X button */
  }
  
  .tag-label {
    flex: 1 1 auto;         /* take remaining space */
    min-width: 0;           /* allow flex item to actually shrink */
    overflow: hidden;       /* apply ellipsis to the text only */
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  .tag-remove {    
    background: rgba(255,255,255,0.5);
    border: none;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background 0.2s ease;
    flex-shrink: 0;         /* never shrink the button */
    margin-left: 4px;       /* Small margin to separate from text */
  }
  
/* .tag-remove {    
    background: rgba(255,255,255,0.5);
    border: none;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background 0.2s ease;
    flex-shrink: 0;
} */

.tag-remove:hover {
    background: rgba(255,255,255,0.5);
}

.dropdown-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #666;
    transition: transform 0.3s ease;
    pointer-events: none;
}

.multiselect-input.active .dropdown-arrow {
    transform: translateY(-50%) rotate(180deg);
}

.dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid transparent;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: none;
}

.dropdown-list.active {
    max-height: 300px;
    overflow-y: auto;
    border: 2px solid #d1d5db;
    border-top: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.dropdown-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
}

.dropdown-item.selected {
    background: #f8f9fa;
    color: var(--primary);
    font-weight: 500;
}

.dropdown-item.selected:hover {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
}

.item-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 12px;
    font-weight: bold;
    position: relative;
    flex-shrink: 0;
}

.dropdown-item.selected .item-checkbox {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.dropdown-item.selected .item-checkbox::before {
    content: '✓';
    font-size: 14px;
    font-weight: bold;
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.dropdown-item:hover .item-checkbox {
    border-color: var(--primary);
    transform: scale(1.05);
}

.dropdown-item:hover:not(.selected) .item-checkbox {
    background: rgba(0, 97, 254, 0.1);
}

.dropdown-item.selected:hover .item-checkbox {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
}

.no-results {
    padding: 20px;
    text-align: center;
    color: #999;
    font-style: italic;
}

.placeholder {
    color: #999;
    pointer-events: none;
}

/* Custom scrollbar for dropdown */
.dropdown-list::-webkit-scrollbar {
    width: 6px;
}

.dropdown-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.dropdown-list::-webkit-scrollbar-thumb {
    background: #9ca3af;
    border-radius: 3px;
}

/* RTL adjustments for the dropdown */
.multiselect-input {
    direction: rtl;
    text-align: right;
}

.search-input {
    direction: rtl;
    text-align: right;
}

.dropdown-item {
    direction: rtl;
    text-align: right;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .multiselect-input {
        min-height: 60px;
        padding: 10px 45px 10px 12px;
    }
    
    .selected-tag {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .dropdown-item {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* Responsive adjustments for the new email filter */
@media (max-width: 768px) {
    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-form .form-group {
        min-width: auto;
        width: 100%;
    }
    
    .filter-form .form-group:last-child {
        align-items: stretch;
        margin-top: 1rem;
    }
    
    .filter-form .form-group:last-child button {
        height: auto;
        min-height: 44px;
        margin-top: 0;
    }
}

/* Ensure proper spacing for the new email filter */
.filter-form .form-group:nth-child(4) {
    flex: 1;
    min-width: 200px;
}

/* Action buttons for licenses table */
.action-buttons {
    text-align: left;
    display: block;
    justify-items: end;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.edit-btn {
    color: #007bff;
}

.edit-btn:hover {
    color: #0056b3;
    background: rgba(0, 123, 255, 0.1);
}

.delete-btn {
    color: #dc3545;
}

.delete-btn:hover {
    color: #c82333;
    background: rgba(220, 53, 69, 0.1);
}

.save-btn {
    color: #28a745;
}

.save-btn:hover {
    color: #1e7e34;
    background: rgba(40, 167, 69, 0.1);
}

.cancel-btn {
    color: #6c757d;
}

.cancel-btn:hover {
    color: #495057;
    background: rgba(108, 117, 125, 0.1);
}

/* Edit mode styles */
.edit-mode {
    background-color: #f8f9fa !important;
}

.edit-input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    background: white;
}

.edit-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 97, 254, 0.2);
}

.edit-select {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    background: white;
}

.edit-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 97, 254, 0.2);
}



/* Responsive adjustments for action buttons */
@media (max-width: 768px) {
    .action-buttons {
        flex-direction: column;
        gap: 4px;
    }
    
    .action-btn {
        padding: 4px;
    }
}


/* Single Select Dropdown Styles */
.multiselect-container.single-select .selected-tag {
    display: none; /* Hide tags for single select */
}

.multiselect-container.single-select .multiselect-input .placeholder {
    color: #333; /* Make selected text darker */
}

.multiselect-container.single-select .dropdown-item {
    padding-left: 16px; /* Remove space for checkbox */
}

.multiselect-container.single-select .dropdown-item.selected {
    background: var(--primary);
    color: white;
    font-weight: 500;
}

.multiselect-container.single-select .dropdown-item.selected:hover {
    background: var(--primary-light);
}

/* Add License Section Styles */
.add-license-section {
    margin-bottom: 30px;
}

.add-license-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    
}

.add-license-section .section-header h3 {
    font-size: 1.2rem;
    color: var(--gray-800);
    margin: 0;
}

.add-license-form {
    display: flex;
    gap: 15px;
    align-items: end;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--gray-300);
    flex-wrap: wrap;
}

.add-license-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.add-license-form .form-group label {
    font-weight: 500;
    color: var(--gray-800);
    font-size: 14px;
    margin-bottom: 4px;
}

.add-license-form .form-control {
    padding: 10px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    transition: all 0.2s ease;
    min-width: 125px;
}

.add-license-form .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 97, 254, 0.1);
}

.add-license-form .primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    padding: 11px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-bottom: 3px;
}

.add-license-form .primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 97, 254, 0.3);
}

.add-license-form .primary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Badge Styles */
.badge.badge-secondary {
    background: var(--gray-400);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* Responsive design for the add license form */
@media (max-width: 768px) {
    .add-license-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .add-license-form .form-group {
        width: 100%;
    }
    
    .add-license-form .form-control,
    .add-license-form .multiselect-input {
        min-width: 100%;
    }
}


/* Licenses Book Multiselect Styles */
.form-group .multiselect-container {
    width: 100%;
}

.form-group .multiselect-input {
    min-height: 40px;
    /* padding: 8px 35px 8px 12px; */
    overflow: hidden;
}

.form-group .selected-tag {
    margin: 2px;
    font-size: 13px;
    padding: 4px 10px;
}

/* Form text styling for multiselect */
.form-group .form-text {
    margin-top: 5px;
    font-size: 12px;
    color: #6c757d;
}

/* Dynamic z-index for active dropdown only */
.dropdown-list.active {
    z-index: 10000;
}

/* Unauthorized Access Styles */
.unauthorized-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f5f7fa;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.unauthorized-card {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 3rem 2rem;
    max-width: 500px;
    width: 90%;
    text-align: center;
    border: 2px solid var(--danger);
}

.unauthorized-icon {
    color: var(--danger);
    margin-bottom: 1.5rem;
}

.unauthorized-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--danger);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.unauthorized-message {
    font-size: 1.1rem;
    color: var(--gray-800);
    margin-bottom: 2rem;
    line-height: 1.5;
}

.logout-btn-unauthorized {
    background-color: var(--danger);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.logout-btn-unauthorized:hover {
    background-color: #d32f2f;
    transform: translateY(-2px);
}

/* Simple Toggle Styles */
.simple-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
    user-select: none;
    padding: 0.25rem 0;
}

.simple-toggle:hover {
    color: var(--primary);
}

.toggle-text {
    font-size: 1rem;
    font-weight: 500;
    color: var(--gray-800);
    transition: var(--transition);
}

.simple-toggle:hover .toggle-text {
    color: var(--primary);
}

.toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 50%;
    transition: var(--transition);
}

.simple-toggle:hover .toggle-icon {
    background-color: var(--primary);
    color: white;
}

/* Scale Indicator Styles */
.scale-indicator {
    font-size: 14px;
    color: #adb5bd;
    font-weight: 500;
    min-width: 45px;
    text-align: center;
    user-select: none;
}

/* Grouping dropdown specific fixes */
.multiselect-input {
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.multiselect-input .search-input {
    position: absolute;
    top: 0;
    left: 0;
    right: 35px;
    bottom: 0;
    /* padding: 8px 12px; */
    font-size: 16px;
    border: none;
    outline: none;
    background: transparent;
    z-index: 1;
}

.multiselect-input .placeholder {
    pointer-events: none;
    padding: 0px 36px;
    color: #6c757d;
    flex: 1;
}

.multiselect-input.active .placeholder {
    display: none;
}

.multiselect-input .search-input:focus {
    background: transparent;
}
.excel-upload-container{
    display: flex;
    
}

/* Form row alignment for licenses form */
.license-form .form-container {
    display: block !important; /* Override the flex display */
    gap: unset;
    flex-direction: unset !important;
}

.form-row {
    display: flex !important;
    align-items: flex-start;
    width: 100%;
}

.form-row .form-column {
    flex: 1 !important;
    display: block !important; /* Override flex-direction: column */
    gap: unset;
    min-width: 0; /* Prevent flex item overflow */
}

.form-row .form-column:last-child {
    flex: 1 !important;
}

/* Ensure form groups have consistent spacing */
.form-row .form-group {
    margin-bottom: 10px !important;
}
