/* Signature Generator - Premium Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --bg-primary: #07090e;
  --bg-secondary: #0f131a;
  --bg-card: rgba(20, 26, 38, 0.6);
  --border-color: rgba(255, 255, 255, 0.07);
  --border-focus: #3b82f6;
  --text-main: #f3f4f6;
  --text-muted: #8e9cae;
  --primary-accent: #3b82f6;
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #7c3aed 100%);
  --success-color: #10b981;
  --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --font-ui: 'Inter', sans-serif;
  --font-heading: 'Outfit', sans-serif;
}

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

body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 10% 20%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
    radial-gradient(at 90% 80%, rgba(124, 58, 237, 0.15) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-ui);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(15, 19, 26, 0.75);
  border-bottom: 1px solid var(--border-color);
  padding: 1.25rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  width: 100%;
  box-sizing: border-box;
}

.btn-contact {
  background: linear-gradient(135deg, #ff6b00 0%, #ff8c00 100%);
  color: white !important;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px rgba(255, 107, 0, 0.25);
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.btn-contact:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 0, 0.4);
}

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

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  background: var(--accent-gradient);
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

.logo-text {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.75rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.logo-tag {
  font-size: 0.75rem;
  font-weight: bold;
  background-color: rgba(59, 130, 246, 0.15);
  color: var(--primary-accent);
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid rgba(59, 130, 246, 0.3);
  margin-left: 0.5rem;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-ui);
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-secondary:active {
  transform: scale(0.97);
}

.app-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  gap: 2rem;
  padding: 2rem;
  overflow-x: hidden;
}

@media (max-width: 1024px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
  .preview-panel {
    order: -1;
  }
}

/* Glassmorphic Panel styling */
.panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: var(--shadow-main);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.panel-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.panel-title i {
  color: var(--primary-accent);
}

/* Tabs UI */
.tabs-header {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  white-space: nowrap;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: white;
  background: var(--accent-gradient);
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.tab-content.active {
  display: block;
}

/* Form Styling */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group.full-width {
  grid-column: span 2;
}

@media (max-width: 640px) {
  .form-group.full-width {
    grid-column: span 1;
  }
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
select {
  width: 100%;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: white;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Social Inputs Icon Integration */
.social-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.social-input-wrapper i {
  position: absolute;
  left: 1rem;
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.social-input-wrapper input {
  padding-left: 2.75rem;
}

.fa-linkedin { color: #0077b5; }
.fa-twitter { color: #1da1f2; }
.fa-instagram { color: #e1306c; }
.fa-facebook { color: #1877f2; }
.fa-youtube { color: #ff0000; }
.fa-github { color: #fafafa; }

/* Image Upload Drag & Drop Area */
.upload-area {
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.01);
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.upload-area:hover {
  border-color: var(--primary-accent);
  background: rgba(59, 130, 246, 0.02);
}

.upload-icon {
  font-size: 2rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.upload-text {
  font-size: 0.9rem;
  color: var(--text-main);
  font-weight: 500;
}

.upload-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.upload-preview {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.upload-preview img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-accent);
}

.btn-remove-img {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-remove-img:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Style Section Custom Selectors */
.color-picker-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.color-input-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.color-input-container input[type="text"] {
  font-family: monospace;
  text-transform: uppercase;
}

input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 8px;
  cursor: pointer;
  background: none;
  flex-shrink: 0;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.radio-group {
  display: flex;
  gap: 1rem;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  text-transform: none;
  font-size: 0.9rem;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.2s;
}

.radio-label input {
  cursor: pointer;
}

.radio-label:hover {
  background: rgba(255, 255, 255, 0.05);
}

.radio-label.selected {
  border-color: var(--primary-accent);
  background: rgba(59, 130, 246, 0.05);
}

/* Preview Canvas */
.preview-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.preview-canvas {
  background: white;
  color: #333333;
  border-radius: 12px;
  padding: 2.5rem 2rem;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: flex-start; /* Left-align the templates */
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);
  overflow-x: auto;
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
  min-width: 0;
  width: 100%;
}

#signature-preview-container {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
}

/* Templates Selection Card Layout */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: auto;
}

@media (max-width: 640px) {
  .templates-grid {
    grid-template-columns: 1fr;
  }
}

.template-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.template-card:hover {
  border-color: rgba(255,255,255,0.15);
  background: rgba(255, 255, 255, 0.04);
}

.template-card.active {
  border-color: var(--primary-accent);
  background: rgba(59, 130, 246, 0.08);
}

.template-icon {
  font-size: 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.template-card.active .template-icon {
  background: var(--accent-gradient);
}

.template-info h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.template-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Export Buttons Grid */
.export-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.btn-primary {
  background: var(--accent-gradient);
  border: none;
  color: white;
  padding: 0.85rem 1.75rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-ui);
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.25);
  flex: 1;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.35);
}

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

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #1e293b;
  border-left: 4px solid var(--success-color);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 1000;
  transform: translateY(150%);
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
  transform: translateY(0);
}

.toast i {
  color: var(--success-color);
  font-size: 1.2rem;
}

/* Keyframe Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: var(--shadow-main);
  transform: scale(0.9);
  transition: transform 0.3s;
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

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

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-close:hover {
  color: white;
}

textarea.code-area {
  width: 100%;
  height: 250px;
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: #10b981;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  padding: 1rem;
  resize: none;
  outline: none;
  margin-bottom: 1.5rem;
}

textarea.custom-textarea {
  color-scheme: dark !important;
  width: 100% !important;
  height: 110px !important;
  background-color: #090d16 !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 8px !important;
  padding: 0.75rem 1rem !important;
  color: #f1f5f9 !important;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace !important;
  font-size: 0.95rem !important;
  outline: none !important;
  transition: border-color 0.2s, box-shadow 0.2s;
  resize: vertical;
  line-height: 1.5;
  -webkit-appearance: none;
  appearance: none;
}

textarea.custom-textarea::placeholder {
  color: rgba(255, 255, 255, 0.35);
  font-family: var(--font-ui);
  font-size: 0.85rem;
}

textarea.custom-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* ==========================================
   Responsive & Mobile Friendly Overrides
   ========================================== */

/* Grid layout for images upload tab */
.image-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

/* Tablets & Small Desktops Viewports */
@media (max-width: 768px) {
  .app-layout {
    padding: 1rem;
    gap: 1.25rem;
  }
  
  .panel {
    padding: 1.25rem;
    border-radius: 12px;
  }
}

/* Mobile Phones Viewports */
@media (max-width: 640px) {
  .image-upload-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .export-actions {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .export-actions button {
    width: 100%;
    justify-content: center;
  }
  
  .color-picker-group {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .instruction-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }

  .preview-canvas {
    padding: 1.25rem 1rem !important;
  }

  .toast {
    bottom: 1rem !important;
    right: 1rem !important;
    left: 1rem !important;
    justify-content: center !important;
  }
}

/* Extra Small Mobile Viewports */
@media (max-width: 500px) {
  .btn-text {
    display: none;
  }
  
  header {
    padding: 1rem;
  }
  
  .logo-text {
    font-size: 1.35rem;
  }
  
  .logo-subtitle {
    font-size: 0.65rem !important;
  }

  .btn-contact {
    padding: 0.45rem 0.85rem;
    font-size: 0.75rem;
  }

  .modal-card {
    padding: 1.25rem;
    max-height: 90vh;
    border-radius: 12px;
  }
}
