/* ============================================================
   RC Roteirista - Estilos Modernos & Minimalistas
   ============================================================ */

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-hover: #30363d;
  
  --border-color: #30363d;
  --border-focus: #388bfd;
  
  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  
  --accent-primary: #238636;
  --accent-primary-hover: #2ea043;
  --accent-blue: #2f81f7;
  --accent-blue-hover: #388bfd;
  
  --danger-bg: rgba(248, 81, 73, 0.1);
  --danger-border: rgba(248, 81, 73, 0.4);
  --danger-text: #f85149;
  
  --success-bg: rgba(35, 134, 54, 0.15);
  --success-text: #3fb950;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.app-header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  background: linear-gradient(135deg, #2f81f7 0%, #1f6feb 100%);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.5px;
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-company {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.btn-logout:hover {
  color: var(--danger-text);
  background: var(--danger-bg);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 40px 0;
}

/* Hero Section */
.hero-section {
  text-align: center;
  margin-bottom: 32px;
}

.hero-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  background: linear-gradient(180deg, #ffffff 0%, #c9d1d9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Cards */
.card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.generator-card {
  margin-bottom: 24px;
}

/* Forms */
.generator-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2.2; }

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

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

input[type="text"],
input[type="password"],
input[type="url"],
select {
  width: 100%;
  padding: 12px 14px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-icon-wrapper input {
  padding-left: 42px;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56, 139, 253, 0.25);
}

input::placeholder {
  color: var(--text-muted);
}

.select-wrapper {
  position: relative;
}

select {
  appearance: none;
  cursor: pointer;
}

.select-wrapper::after {
  content: "▾";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 12px;
}

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--accent-blue);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--accent-blue-hover);
}

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

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-hover);
  border-color: var(--text-secondary);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 13px 24px;
  font-size: 15px;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  font-size: 12px;
}

/* Form Actions */
.form-actions {
  display: flex;
  justify-content: flex-end;
}

/* Loading & Spinners */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

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

.loading-card {
  text-align: center;
  padding: 40px 20px;
  margin-bottom: 24px;
}

.pulse-spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 16px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 1s ease-in-out infinite;
}

.loading-content h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.loading-content p {
  color: var(--text-secondary);
  font-size: 14px;
  max-width: 500px;
  margin: 0 auto;
}

/* Error Card */
.error-card {
  background-color: var(--danger-bg);
  border-color: var(--danger-border);
  margin-bottom: 24px;
  padding: 16px 20px;
}

.error-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--danger-text);
}

.error-header h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.error-header p {
  font-size: 13px;
  color: #ff8182;
  line-height: 1.4;
}

/* Result Section */
.result-section {
  animation: fadeIn 0.3s ease-out;
}

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

.result-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.client-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(47, 129, 247, 0.15);
  color: var(--accent-blue);
  margin-bottom: 4px;
}

.result-heading {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Script Blocks */
.script-blocks {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.script-block {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  transition: border-color 0.2s;
}

.script-block:hover {
  border-color: #3f4752;
}

.script-block-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--bg-tertiary);
}

.script-block-body {
  font-size: 14px;
  color: #c9d1d9;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Login Card */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 0;
}

.login-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
}

.login-header h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 6px;
}

.login-header p {
  font-size: 13px;
  color: var(--text-muted);
}

.alerts-container {
  margin-bottom: 18px;
}

.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.alert-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Footer */
.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding: 20px 0;
  background: var(--bg-secondary);
  text-align: center;
}

.footer-container p {
  font-size: 12px;
  color: var(--text-muted);
}

/* Utility */
.d-none { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
    gap: 14px;
  }
  
  .flex-2, .flex-1 {
    width: 100%;
  }
  
  .btn-lg {
    width: 100%;
  }

  .result-header-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .result-actions {
    width: 100%;
  }

  .result-actions .btn {
    width: 100%;
  }
}
