/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Base styles */
* {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
}

body {
  margin: 0;
  padding: 0;
  line-height: 1.6;
  color: #333;
  background-color: #f8f9fa;
  font-size: 14px;
}

button {
  font-size: 14px;
  font-weight: 500;
}

select {
  height: 100%;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

h4 {
  font-size: 1.125rem;
}

h5 {
  font-size: 1rem;
}

h6 {
  font-size: 0.875rem;
}

.row {
  display: flex;
}

.col {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-4 {
  gap: 1rem;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-4 {
  margin-top: 1rem;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.w-full {
  width: 100%;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* Universal Button System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 6px;
  transition: all 0.2s ease;
  min-height: 36px;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

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

/* Button variants */
.btn-primary {
  background-color: #1a73e8;
  border-color: #1a73e8;
  color: white;
}

.btn-primary:hover {
  background-color: #1557b0;
  border-color: #1557b0;
  color: white;
  box-shadow: 0 2px 4px rgba(26, 115, 232, 0.3);
}

.btn-secondary {
  background-color: white;
  border-color: #dadce0;
  color: #5f6368;
}

.btn-secondary:hover {
  background-color: #f8f9fa;
  border-color: #5f6368;
  color: #202124;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-danger {
  background-color: white;
  border-color: #ea4335;
  color: #ea4335;
}

.btn-danger:hover {
  background-color: #ea4335;
  border-color: #ea4335;
  color: white;
  box-shadow: 0 2px 4px rgba(234, 67, 53, 0.3);
}

.btn-outline-primary {
  background-color: transparent;
  border-color: #1a73e8;
  color: #1a73e8;
}

.btn-outline-primary:hover {
  background-color: #1a73e8;
  color: white;
}

.btn-outline-secondary {
  background-color: transparent;
  border-color: #6c757d;
  color: #6c757d;
}

.btn-outline-secondary:hover {
  background-color: #6c757d;
  color: white;
}

.btn-outline-danger {
  background-color: transparent;
  border-color: #ea4335;
  color: #ea4335;
}

.btn-outline-danger:hover {
  background-color: #ea4335;
  color: white;
}

.btn-admin {
  background-color: #6f42c1;
  border-color: #6f42c1;
  color: white;
}

.btn-admin:hover {
  background-color: #5a359a;
  border-color: #5a359a;
}

/* Button sizes */
.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
  min-height: 32px;
}

.btn-lg,
.btn-large {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  min-height: 44px;
}

/* Fix button_to form styling globally */
form[method="post"],
form[method="patch"] {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  width: fit-content;
}

/* Navbar styles */
.navbar {
  background-color: #fff;
  border-bottom: 1px solid #e9ecef;
  padding: 0.75rem 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);

  position: absolute;
  top: 1em;
  right: 2em;
}

.navbar-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-brand .brand-link {
  font-size: 1.5rem;
  font-weight: bold;
  color: #007bff;
  text-decoration: none;
}

.navbar-brand .brand-link:hover {
  color: #0056b3;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-info {
  font-size: 0.9rem;
  color: #666;
}

.role-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  text-transform: uppercase;
  font-weight: bold;
  margin-left: 0.5rem;
}

.role-admin {
  background-color: #dc3545;
  color: white;
}

.role-user {
  background-color: #28a745;
  color: white;
}

/* Main content */
.main-content {
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Universal Card System */
.card {
  background: white;
  border-radius: 12px;
  border: 1px solid #e9ecef;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.card-header {
  padding: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.card-title h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.card-body,
.card-details {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-body>ul {
  margin-bottom: auto;
  padding: 1.5rem;
}

.card-details {
  padding: 1.5rem;
}

.card-actions {
  padding: 1rem 1.5rem;
  background-color: #f8f9fa;
  border-top: 1px solid #e9ecef;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.card-actions .btn {
  flex: 1;
}

.card-actions .btn-danger {
  flex: none;
  min-width: 80px;
}

/* Universal Grid System */
.grid {
  display: grid;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.grid-auto-fit {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-auto-fill {
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
}

/* Detail rows for cards */
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f3f4;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-row .label {
  font-weight: 600;
  color: #5f6368;
  font-size: 0.9rem;
}

.detail-row .value {
  color: #202124;
  font-size: 0.9rem;
}

/* Universal Badge System */
.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.badge-success {
  background-color: #e8f5e8;
  color: #2e7d32;
}

.badge-danger {
  background-color: #ffeaea;
  color: #c62828;
}

.badge-warning {
  background-color: #fff8e1;
  color: #f57c00;
}

/* Universal Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: white;
  border-radius: 12px;
  border: 1px solid #e9ecef;
  margin-top: 2rem;
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 1.5rem;
  opacity: 0.6;
}

.empty-state h2 {
  color: #202124;
  margin-bottom: 1rem;
}

.empty-state p {
  color: #5f6368;
  margin-bottom: 0.5rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.empty-state .btn-lg {
  margin-top: 1.5rem;
}

/* Domain-specific styles */
.domains-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.domain-card {
  /* Uses .card base styles */
}

.domain-header {
  justify-content: space-between;
  align-items: flex-start;
}

.domain-name {
  color: #333;
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 600;
}

.domain-name:hover {
  color: #007bff;
}

.domain-stats {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e9ecef;
}

/* Integration-specific styles */
.integration-header {
  background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
  color: white;
}

.integration-icon {
  font-size: 1.5rem;
  opacity: 0.9;
}

.integration-account {
  margin: 0.25rem 0 0 0;
  opacity: 0.9;
  font-size: 0.9rem;
}

.delete-form {
  margin-left: auto;
}

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

/* Account-specific styles */
.account-actions {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
}

.account-name {
  color: #333;
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 600;
}

.account-name:hover {
  color: #007bff;
}

/* Table styles */
.table {
  width: 100%;
  margin-bottom: 1rem;
  background-color: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(0, 0, 180, 0.03);
}

.table thead th {
  background-color: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
  font-weight: 600;
  color: #495057;
  padding: 0.75rem;
}

.table tbody td {
  padding: 0.75rem;
  border-bottom: 1px solid #dee2e6;
  vertical-align: middle;
}

.table-responsive,
.table-container {
  overflow-x: auto;
  margin-bottom: 1rem;
}

/* Utility classes */
.subtitle {
  color: #666;
  margin-bottom: 2rem;
}

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

.section-actions {
  margin-top: 1rem;
  text-align: right;
}

.connect-more {
  margin-top: 3rem;
  padding-top: 2rem;
}

.connect-more .text-center {
  text-align: center;
}

.connect-more h3 {
  color: #202124;
  margin-bottom: 0.5rem;
}

.connect-more p {
  color: #5f6368;
  margin-bottom: 1.5rem;
}

.text-muted {
  color: #6c757d;
}

.stat-label {
  color: #666;
}

.stat-value {
  font-weight: bold;
  color: #0066cc;
}

.form-hint {
  display: block;
  color: #666;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.small-text {
  font-size: 0.85em;
}

/* Text utility classes */
.text-muted {
  color: #6c757d;
}

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

/* Link styles */
.domain-link,
.account-link,
.integration-link {
  color: #007bff;
  text-decoration: none;
  font-weight: 500;
}

.domain-link:hover,
.account-link:hover,
.integration-link:hover {
  color: #0056b3;
  text-decoration: underline;
}

/* Legacy table styles for compatibility */
table {
  text-align: left;
  font-size: 0.9em;
  width: 100%;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

tr:nth-child(2n-1) td {
  background: rgba(0, 0, 180, 0.05);
}

tr.danger td {
  background: rgba(255, 85, 0, 0.3);
}

tr.warning td {
  background: rgba(255, 174, 0, 0.3);
}

th {
  font-style: italic;
}

th,
td {
  font-weight: normal;
  padding: 0.15em 0.5em;
  text-wrap: nowrap;
}

/* Legacy styles */
aside {
  font-style: italic;
  font-weight: 200;
  font-size: 1.1em;
}

/* Responsive design */
@media (max-width: 768px) {
  .grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .card-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .card-actions .btn {
    width: 100%;
    flex: none;
  }

  .card-actions form {
    width: 100%;
  }
}

/* Reports Section Styling */
.reports-section {
  margin-top: 2rem;
}

.section-header {
  border-bottom: 2px solid #f8f9fa;
  padding-bottom: 1rem;
}

.section-header h4 {
  color: #2c3e50;
  font-weight: 600;
}

/* Report Type Cards */
.report-type-card {
  background: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  height: 100%;
}

.report-type-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.report-type-header {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid #f1f3f4;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border-radius: 12px 12px 0 0;
}

.report-type-title h5 {
  color: #2c3e50;
  font-weight: 600;
  font-size: 1.1rem;
}

.report-icon {
  font-size: 1.2rem;
  opacity: 0.8;
}

.report-count .badge {
  font-size: 0.75rem;
  padding: 0.4rem 0.6rem;
  border-radius: 20px;
  font-weight: 500;
}

.report-type-body {
  padding: 1.25rem;
  max-height: 400px;
  overflow-y: auto;
}

/* Individual Report Cards */
.report-card {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 1rem;
  transition: all 0.2s ease;
}

.report-card:hover {
  background: #f1f3f4;
  border-color: #ced4da;
}

.report-card:last-child {
  margin-bottom: 0 !important;
}

/* Report Status Badges */
.report-status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.35rem 0.6rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-pending {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.badge-processing {
  background-color: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

.badge-completed {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.badge-failed {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.badge-expired {
  background-color: #e2e3e5;
  color: #383d41;
  border: 1px solid #d6d8db;
}

.report-id {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.7rem;
  background: #e9ecef;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.report-date {
  color: #6c757d;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.report-date i {
  font-size: 0.75rem;
  opacity: 0.7;
}

/* View Report Button */
.view-report-btn {
  font-size: 0.8rem;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1.5px solid #1a73e8;
  white-space: nowrap;
}

.view-report-btn:hover {
  background-color: #1a73e8;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(26, 115, 232, 0.3);
}

.view-report-btn i {
  margin-right: 0.3rem;
  font-size: 0.75rem;
}

/* Report Type Footer */
.report-type-footer {
  text-align: center;
}

.report-type-footer .btn-link {
  color: #1a73e8;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem;
}

.report-type-footer .btn-link:hover {
  color: #0d47a1;
  background-color: rgba(26, 115, 232, 0.05);
  border-radius: 6px;
}

/* Empty State */
.empty-reports-state {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border: 2px dashed #dee2e6;
  border-radius: 12px;
  margin: 2rem 0;
}

.empty-icon {
  opacity: 0.6;
}

.empty-reports-state h5 {
  color: #495057;
  font-weight: 600;
}

.empty-reports-state .btn {
  font-weight: 500;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
}

/* Responsive Design for Reports */
@media (max-width: 768px) {
  .reports-section {
    margin-top: 1.5rem;
  }

  .section-header h4 {
    font-size: 1.25rem;
  }

  .report-type-card {
    margin-bottom: 1rem;
  }

  .report-type-header {
    padding: 1rem;
  }

  .report-type-body {
    padding: 1rem;
    max-height: 300px;
  }

  .report-card {
    padding: 0.75rem;
  }

  .report-details {
    flex-direction: column;
    gap: 0.5rem;
  }

  .report-actions {
    margin-left: 0 !important;
    margin-top: 0.5rem;
  }

  .view-report-btn {
    font-size: 0.75rem;
    padding: 0.35rem 0.7rem;
  }

  .empty-reports-state {
    margin: 1rem 0;
  }

  .empty-reports-state .d-flex {
    flex-direction: column;
    gap: 0.5rem;
  }

  .empty-reports-state .btn {
    width: 100%;
    max-width: 200px;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(-100%);
  }

  to {
    transform: translateY(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

.notification {
  position: fixed;
  top: 1em;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 300px;
  padding: 1em;
  border-radius: 0.5em;
  background-color: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);

  display: flex;
  align-items: center;
  justify-content: space-between;

  animation: slideIn 0.3s ease-out forwards;
}
.notification.fade-out {
  animation: fadeOut 0.3s ease-out forwards;
}

.notification>button {
  border: none;
  padding: 0;
  width: 36px;
  font-size: 24px;
}

/* Tracking URLs Section Styling */
.tracking-urls {
  border-top: 2px solid #e9ecef;
  padding-top: 2rem;
}

.tracking-urls .section-title {
  color: #495057;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}

.tracking-urls .subsection-title {
  color: #6c757d;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.tracking-urls .section-description {
  color: #6c757d;
  margin-bottom: 1.5rem;
}

.domain-badge {
  background: #e3f2fd;
  color: #1976d2;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.tracking-url {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
  padding: 0.5rem;
  font-size: 0.8rem;
  word-break: break-all;
  max-width: calc(1200px - 48px - 104px - 114px - 100px);
  display: block;
  transition: background-color 0.3s ease;
  overflow-x: auto;
}

.tracking-url:hover {
  background: #e9ecef;
}

.campaign-name .badge {
  font-size: 0.875rem;
}

.usage-instructions {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  padding: 1.5rem;
}

.usage-instructions ul {
  margin-bottom: 0;
}

.usage-instructions li {
  margin-bottom: 0.75rem;
  padding-left: 1rem;
}

.usage-instructions li:last-child {
  margin-bottom: 0;
}

.copy-btn {
  transition: all 0.3s ease;
  min-width: 80px;
}

.copy-btn:hover {
  transform: translateY(-1px);
}

.empty-state {
  background: #f8f9fa;
  border: 2px dashed #dee2e6;
  border-radius: 0.5rem;
  margin: 2rem 0;
}

/* Deleted Integration Styling */
.deleted-integration {
  opacity: 0.7;
  border: 2px dashed #ffc107 !important;
  background: rgba(255, 193, 7, 0.05) !important;
}

.deleted-integration .card-header {
  background: rgba(255, 193, 7, 0.1) !important;
}

.deleted-integration .integration-icon {
  filter: grayscale(0.5);
}

/* Pagination */
ul.pagination {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pagination {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pagination .page-item {
  display: block;
}

.pagination .page-item .page-link {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
}

.pagination .page-item.active .page-link {
  background-color: #1a73e8;
  color: white;
}

.block {
  display: block;
}