:root {
  --primary-color: #007ec7; /* Corporate blue */
  --primary-dark: #005fa3;
  --primary-light: #e6f4fb;
  --secondary-color: #4f46e5;
  --secondary-light: #818cf8;
  --accent-color: #3b82f6;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --danger-light: #fee2e2;
  --background-color: #f8fafc;
  --card-background: #ffffff;
  --border-color: #e2e8f0;
  --sidebar-width: 250px;
  --sidebar-collapsed-width: 80px;
  --topbar-height: 60px;
  --card-radius: 8px;
  --input-radius: 8px;
  --transition-speed: 0.3s;
  --box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
  --primary-color: #2563eb;
  --primary-dark: #1e3aa1;
  --primary-light: #23262f;
  --secondary-color: #818cf8;
  --secondary-light: #6366f1;
  --accent-color: #60a5fa;
  --text-primary: #f3f4f6;
  --text-secondary: #a1a1aa;
  --text-light: #6b7280;
  --success-color: #22c55e;
  --warning-color: #fbbf24;
  --danger-color: #ef4444;
  --danger-light: #2a2d3a;
  --background-color: #181a20;
  --card-background: #23262f;
  --border-color: #2a2d3a;
  --sidebar-width: 250px;
  --sidebar-collapsed-width: 80px;
  --topbar-height: 60px;
  --card-radius: 8px;
  --input-radius: 8px;
  --transition-speed: 0.3s;
  --box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.15);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.25), 0 2px 4px -1px rgba(0, 0, 0, 0.18);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.25), 0 4px 6px -2px rgba(0, 0, 0, 0.18);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--background-color);
  color: #333;
  min-height: 100vh;
  overflow-x: hidden;
}

.dashboard-container {
  display: flex;
  min-height: 100vh;
}

.dashboard-container.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed-width) -1fr;
}

/* ===== TEMPLATE PREVIEW ===== */
.template-preview {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--card-background);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
}

.template-preview h4 {
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
}

.preview-container {
  min-height: 120px;
  padding: 1rem;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

[data-theme="dark"] .preview-container {
  background: #2a2d3a;
  border-color: #3a3f4a;
  color: var(--text-light);
}

/* ===== SIDEBAR ===== */
/* Sidebar 
.sidebar {
  background: linear-gradient(195deg, #007ec7, #02204e);
  color: white;
  padding: 1rem 0;
  width: var(--sidebar-width);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-speed) ease;
  z-index: 100;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidebar .logo {
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
  color: white;
}

.sidebar .logo i {
  font-size: 1.5rem;
}

.nav-menu {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0 0.75rem;
}

.nav-section {
  margin-top: 1.5rem;
  padding-left: 0.75rem;
}

.nav-section h3 {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
  margin-bottom: 0.5rem;
  padding-left: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: #b8c2cc;
  text-decoration: none;
  transition: all var(--transition-speed) ease;
  border-radius: var(--card-radius);
  font-size: 0.9rem;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
}

.main-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  transition: margin-left var(--transition-speed) ease;
  width: calc(100% - var(--sidebar-width));
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem;
  padding-top: calc(var(--topbar-height) + 1rem);
  background-color: var(--background-color);
  min-height: 100vh;
}

 /* Top Bar */
.top-bar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    box-shadow: var(--box-shadow);
    z-index: 99;
}

.top-bar .search-bar {
    flex: 1;
    max-width: 400px;
    margin-right: 1rem;
}

.top-bar .search-bar input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: var(--card-radius);
    font-size: 0.9rem;
    background-color: #f5f5f5;
}

.top-bar .user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-bar .notification-bell {
    position: relative;
    cursor: pointer;
}

.top-bar .notification-bell i {
    font-size: 1.2rem;
    color: #555;
}

.top-bar .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary-color);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.75rem;
}

/* --- Top Bar Dropdown Fix --- */
.top-bar .user-profile {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.top-bar .dropdown-menu {
    display: none;
    position: absolute;
    background-color: white;
    box-shadow: var(--box-shadow);
    border-radius: var(--card-radius);
    overflow: hidden;
    z-index: 1000;
    right: 0;
    top: 110%;
    min-width: 180px;
    animation: fadeIn 0.2s;
}

.top-bar .user-profile.open .dropdown-menu {
    display: block;
}

.top-bar .dropdown-menu a {
    color: #333;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.top-bar .dropdown-menu a:hover {
    background-color: #f0f0f0;
}

/* Settings specific styles */
.settings-header {
  margin-bottom: 2rem;
}

.settings-header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 0.5rem;
}

.settings-header p {
  color: var(--text-light);
  font-size: 1rem;
}

.settings-container {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.settings-nav {
  position: sticky;
  top: calc(var(--topbar-height) + 2rem);
  height: fit-content;
}

.settings-tabs {
  list-style-type: none;
  padding: 0;
  background: var(--card-background);
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.settings-tabs li a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  color: var(--text-color);
  text-decoration: none;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
}

.settings-tabs li a:hover {
  background-color: var(--hover-background);
}

.settings-tabs li a.active {
  background-color: var(--hover-background);
  color: var(--primary-color);
  border-left: 3px solid var(--primary-color);
  font-weight: 500;
}

.settings-tabs li a i {
  width: 20px;
  text-align: center;
}

.settings-content {
  min-height: 600px;
}

.settings-section {
  display: none;
  background: var(--card-background);
  border-radius: var(--card-radius);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.settings-section.active {
  display: block;
}

.section-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-header p {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* Form styling */
.form-group {
  margin-bottom: 2rem;
}

.form-group h3 {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 1rem;
  color: var(--text-color);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

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

.form-control label {
  font-weight: 500;
  color: var(--text-color);
  font-size: 0.95rem;
}

.form-control label .required {
  color: var(--danger-color);
  font-weight: 700;
}

.form-control input[required]:invalid {
  border-color: var(--danger-color);
}

.form-control input[required]:invalid:focus {
  border-color: var(--danger-color);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Warning styling for required fields */
.form-control input[data-warning] {
  border-color: var(--warning-color);
  background-color: rgba(245, 158, 11, 0.05);
}

.form-control input[data-warning]:focus {
  border-color: var(--warning-color);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.warning-message {
  color: var(--warning-color);
  font-size: 0.75rem;
  margin-top: 0.25rem;
  font-style: italic;
}

.form-control .form-help {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-style: italic;
}

input, select, textarea {
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--small-radius);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.3s ease;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 126, 199, 0.2);
}

input.valid {
  border-color: var(--success-color);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

input.invalid {
  border-color: var(--danger-color);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

input[type="file"] {
  padding: 0.5rem;
  font-size: 0.9rem;
}

input[type="color"] {
  width: 50px;
  height: 40px;
  padding: 0;
  cursor: pointer;
}

.color-picker-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.color-picker-container input[type="color"] {
  width: 50px;
  height: 40px;
  border: 2px solid var(--border-color);
  border-radius: var(--input-radius);
  cursor: pointer;
  background: none;
  transition: all 0.3s ease;
}

.color-picker-container input[type="color"]:hover {
  border-color: var(--primary-color);
  transform: scale(1.05);
}

.color-picker-container input[type="color"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 126, 199, 0.1);
}

.color-picker-container span {
  font-size: 0.9rem;
  color: var(--text-light);
  font-weight: 500;
  padding: 8px 12px;
  background: var(--card-background);
  border: 1px solid var(--border-color);
  border-radius: var(--input-radius);
  min-width: 80px;
  text-align: center;
}

/* Checkbox styling */
.checkbox-control {
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  margin-bottom: 0.5rem;
}

.checkbox-control label {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.checkbox-control input[type="checkbox"] {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  width: 18px !important;
  height: 18px !important;
  border: 2px solid var(--border-color) !important;
  background-color: white !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  position: relative !important;
  transition: all 0.3s ease !important;
  padding: 0 !important;
  min-height: auto !important;
  font-size: inherit !important;
  display: inline-block !important;
  vertical-align: middle !important;
  box-sizing: border-box !important;
}

.setting-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  line-height: 1.4;
  font-style: italic;
}



.checkbox-control input[type="checkbox"]:checked {
  background-color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
}

.checkbox-control input[type="checkbox"]:checked {
  background-color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.checkbox-control input[type="checkbox"]:hover {
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 2px rgba(0, 126, 199, 0.1);
}

.checkbox-control input[type="checkbox"]:focus {
  outline: none !important;
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 3px rgba(0, 126, 199, 0.2);
}

/* Dark mode checkbox styles */
[data-theme="dark"] .checkbox-control input[type="checkbox"] {
  background-color: var(--card-background) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .checkbox-control input[type="checkbox"]:checked {
  background-color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .checkbox-control input[type="checkbox"]:hover {
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

[data-theme="dark"] .checkbox-control input[type="checkbox"]:focus {
  outline: none !important;
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

.checkbox-control input[type="checkbox"]:checked::after {
  content: '\2714';
  color: white !important;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: bold;
  line-height: 1;
  text-align: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  z-index: 1;
  text-shadow: none;
}

/* Toggle switch styling */
.toggle-control {
  flex-direction: row;
  align-items: center;
  gap: 1rem;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--primary-color);
}

input:focus + .toggle-slider {
  box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Button styling */
.form-actions {
  display: flex;
  justify-content: flex-start;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--button-radius);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

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

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

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

.btn-success:hover {
  background-color: #1ca64a;
}

.btn-secondary {
  background-color: #e2e8f0;
  color: var(--text-color);
}

.btn-secondary:hover {
  background-color: #cbd5e1;
}

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

.btn-danger:hover {
  background-color: #dc2626;
}

.btn-danger-outlined {
  background-color: transparent;
  color: var(--danger-color);
  border: 1px solid var(--danger-color);
}

.btn-danger-outlined:hover {
  background-color: rgba(239, 68, 68, 0.1);
}

/* Logo upload styling */
.logo-upload-container {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.logo-preview {
  width: 150px;
  height: 150px;
  border: 1px dashed var(--border-color);
  border-radius: var(--small-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: var(--hover-background);
}

.logo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-lighter);
}

.logo-placeholder i {
  font-size: 2rem;
}

.logo-placeholder span {
  font-size: 0.85rem;
  text-align: center;
}

#logo-preview-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.logo-upload-controls {
  flex: 1;
}

.upload-help {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-light);
}

/* Integrations styling */
.integrations-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.integration-card {
  display: flex;
  align-items: center;
  padding: 1.5rem;
  background-color: var(--card-background);
  border-radius: var(--small-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.integration-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.integration-logo {
  font-size: 2rem;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1rem;
  color: var(--primary-color);
}

.integration-info {
  flex: 1;
}

.integration-info h3 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.integration-info p {
  color: var(--text-light);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.integration-status {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 500;
}

.integration-status.connected {
  background-color: rgba(34, 197, 94, 0.1);
  color: var(--success-color);
}

.integration-status.not-connected {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
}

/* Password strength meter */
.password-strength-meter {
  height: 4px;
  background-color: var(--border-color);
  border-radius: 2px;
  margin: 0.5rem 0;
  overflow: hidden;
}

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

.password-strength-text {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* QR code placeholder */
.qr-placeholder {
  width: 160px;
  height: 160px;
  background-color: var(--hover-background);
  border: 1px dashed var(--border-color);
  border-radius: var(--small-radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-lighter);
  gap: 0.75rem;
  padding: 1rem;
}

.qr-placeholder i {
  font-size: 2.5rem;
}

.qr-placeholder p {
  font-size: 0.85rem;
  text-align: center;
}

/* Toast notifications */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  min-width: 300px;
  padding: 1rem;
  border-radius: var(--small-radius);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 1rem;
  animation: slideIn 0.3s ease, fadeOut 0.5s ease 2.5s forwards;
  overflow: hidden;
  position: relative;
}

.toast::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 100%;
  background-color: rgba(255, 255, 255, 0.3);
}

.toast.success {
  background-color: var(--success-color);
  color: white;
}

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

.toast.info {
  background-color: var(--info-color);
  color: white;
}

.toast.warning {
  background-color: var(--warning-color);
  color: white;
}

.toast-icon {
  font-size: 1.25rem;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

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

.toast-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.25rem;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.toast-close:hover {
  opacity: 1;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Loading overlay */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 126, 199, 0.2);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s ease-in-out infinite;
}

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

/* Modal styling */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-content {
  background-color: var(--card-background);
  border-radius: var(--card-radius);
  width: 100%;
  max-width: 500px;
  overflow: hidden;
  animation: modalSlideIn 0.3s ease;
}

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

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

.close-button {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
  transition: color 0.3s ease;
}

.close-button:hover {
  color: var(--danger-color);
}

.modal-body {
  padding: 1.5rem;
}

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

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hidden {
  display: none !important;
}

/* Responsive styles */
@media (max-width: 1100px) {
  .settings-container {
    grid-template-columns: 1fr;
  }

  .settings-nav {
    position: static;
    margin-bottom: 2rem;
  }

  .settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .settings-tabs li {
    flex: 1;
    min-width: 200px;
  }

  .settings-tabs li a {
    border-left: none;
    border-bottom: 3px solid transparent;
    text-align: center;
    justify-content: center;
  }

  .settings-tabs li a.active {
    border-left: none;
    border-bottom: 3px solid var(--primary-color);
  }
}

@media (max-width: 768px) {
  .dashboard-container {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    z-index: 1000;
    transform: translateX(-100%);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .top-bar {
    left: 0;
  }

  .main-content {
    margin-top: calc(var(--topbar-height) + 1rem);
    padding: 1rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .logo-upload-container {
    flex-direction: column;
    align-items: center;
  }

  .settings-header h1 {
    font-size: 1.5rem;
  }

  .settings-tabs li a {
    padding: 0.75rem;
  }

  .settings-tabs li a i {
    margin-right: 0.5rem;
  }

  .integrations-container {
    grid-template-columns: 1fr;
  }

  .settings-section {
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .top-bar {
    padding: 0 1rem;
  }

  .search-bar {
    display: none;
  }

  .user-profile span {
    display: none;
  }

  .form-actions {
    flex-wrap: wrap;
  }

  .btn {
    width: 100%;
  }
}

.template-preview {
    margin-top: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1rem;
}

.template-preview h4 {
    margin: 0 0 1rem 0;
    color: #666;
}

.preview-container {
    background: #f5f5f5;
    padding: 1rem;
    border-radius: 4px;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    position: relative;
}

.preview-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* Template selection styles */
#invoice-template {
    margin-bottom: 1rem;
}

.template-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.template-option {
    border: 2px solid #ddd;
    border-radius: 4px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.template-option:hover {
    border-color: var(--primary-color);
}

.template-option.selected {
    border-color: var(--primary-color);
    background-color: rgba(var(--primary-color-rgb), 0.05);
}

.template-option img {
    width: 100%;
    height: auto;
    border-radius: 2px;
    margin-bottom: 0.5rem;
}

.template-option h5 {
    margin: 0;
    color: #333;
}

.template-option p {
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
    color: #666;
}
