:root {
  --primary-color: #eab308; /* Yellow from design */
  --primary-hover: #ca8a04;
  --sidebar-bg: #292d36; /* Dark sidebar */
  --sidebar-text: #9ca3af;
  --sidebar-active: #eab308;
  --text-dark: #374151;
  --text-light: #6b7280;
  --bg-body: #f3f4f6;
  --bg-card: #ffffff;
  --border-color: #e5e7eb;
  
  --secondary-color: #7289da; /* Requested Blue for projects */
  --secondary-color-light: rgba(114, 137, 218, 0.08);

  /* Space Grotesk Font */
  --font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-body);
  color: var(--text-dark);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.header {
  height: 72px;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  flex-shrink: 0;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
}

.logo-icon {
  width: 32px;
  height: 32px;
  background-color: var(--text-dark);
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  font-weight: bold;
  font-size: 1.2rem;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.user-profile:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

/* User Dropdown Menu */
.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  width: 240px;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
}

.user-dropdown-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-header {
  padding: 0.75rem 1.2rem;
  display: flex;
  flex-direction: column;
  cursor: default;
}

.dropdown-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-dark);
}

.dropdown-email {
  font-size: 0.8rem;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 0.5rem 0;
}

.dropdown-item {
  padding: 0.6rem 1.2rem;
  color: var(--text-dark);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.dropdown-item:hover {
  background-color: var(--bg-body);
  color: var(--primary-hover);
}

.dropdown-item.danger {
  color: #ef4444;
}

.dropdown-item.danger:hover {
  background-color: #fef2f2;
}


.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--text-dark);
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-dark);
}

.user-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.user-name {
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.2;
}

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

/* App Layout */
.app-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.result-textarea {
  min-height: 400px;
  background: #f8fafc;
}

/* Markdown Rendering Alanı İçin Özel Stiller */
.result-render-area p {
    margin-bottom: 1.2rem;
}

.result-render-area strong {
    font-weight: 700;
}

.result-render-area h1, .result-render-area h2, .result-render-area h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.result-render-area ul, .result-render-area ol {
    margin-bottom: 1.2rem;
    padding-left: 1.5rem;
}

.result-render-area li {
    margin-bottom: 0.5rem;
}

.action-row {
  display: flex;
  flex-direction: column;
  padding: 2rem 0;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background-color: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 2rem 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
}

.nav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.nav-item.active {
  color: var(--sidebar-active);
  font-weight: 600;
}

/* Rol-bazlı (RBAC) Sayfa Linkleri İçin Varsayılan Gizlilik 
   (Sayfa açılırken yanıp sönmeyi -FOUC- engellemek için JS yetki verene kadar gizlenir) */
a[href="settings.html"], 
a[href="usage.html"],
a[href="admin.html"] {
    display: none;
}

/* Cache üzerinden senkron yetki verilmişse anında göster (FOUC çözümü) */
html.role-admin a[href="admin.html"],
html.role-admin a[href="usage.html"] {
    display: flex !important;
}

html.role-superadmin a[href="settings.html"] {
    display: flex !important;
}

html.role-superadmin #superadmin-usage-panel,
html.role-superadmin #superadmin-workspaces-section {
    display: block !important;
}

/* Main Content Area */
.main-content {
  flex: 1;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
}

.hero-banner {
  width: calc(100% - 2rem);
  height: 320px;
  margin: 1rem 1rem 0 1rem;
  background-image: url('https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?q=80&w=2670&auto=format&fit=crop');
  background-size: cover;
  background-position: center center;

  position: relative;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 3rem 4rem;
}

.hero-banner::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    linear-gradient(to bottom, rgba(43, 48, 59, 0.2), rgba(43, 48, 59, 0.85)),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E");
  z-index: 1;
  backdrop-filter: blur(48px);
  -webkit-backdrop-filter: blur(48px);
}

.hero-banner-content {
  position: relative;
  z-index: 2;
  color: white;
}

.hero-title {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -1px;
}

.hero-subtitle {
  font-size: 1.15rem;
  font-weight: 400;
  opacity: 0.9;
}

.content-wrapper {
  padding: 1rem;
  flex: 1;
}

/* Custom Scrollbar Utility */
.custom-scrollbar {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 20px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background-color: #a0a0ab;
}

.content-card {
  background: var(--bg-card);
  padding: 2.5rem;
  border: 1px solid var(--border-color);
  min-height: 300px;
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.section-title {
  color: var(--text-dark);
  font-size: 1.6rem;
  font-weight: 500;
  margin-bottom: 0;
  letter-spacing: -0.5px;
}

.section-description {
  color: #9ca3af;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0;
  letter-spacing: 0.5px;
}

/* Brand Selection List */
.brand-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2rem;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

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

.modal-content {
    background: #fff;
    width: 600px;
    max-width: 90%;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

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

.modal-header h2 {
    font-size: 1.25rem;
    color: var(--text-dark);
    margin: 0;
}

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

.modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

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

.brand-item {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  color: var(--text-dark);
  font-size: 0.9rem;
}

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

.brand-item:hover {
  background-color: var(--bg-body);
}

.brand-item.selected {
  background-color: rgba(234, 179, 8, 0.08); /* Yellow tint */
  color: var(--primary-hover);
  border-left: 4px solid var(--primary-color); 
  padding-left: calc(1.5rem - 4px);
}

.project-selection-item.selected {
  background-color: var(--secondary-color-light); /* Blue tint */
  color: var(--secondary-color);
  border-left: 4px solid var(--secondary-color);
  padding-left: calc(1.5rem - 4px);
}

/* Accordion Container Styles */
.accordion-group {
    border-bottom: 1px solid var(--border-color);
}
.accordion-group:last-child {
    border-bottom: none;
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.accordion-header:hover {
    background-color: var(--bg-body);
}

.accordion-header.selected {
    background-color: rgba(234, 179, 8, 0.08);
    color: var(--primary-hover);
    border-left: 4px solid var(--primary-color); 
    padding-left: calc(1.5rem - 4px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chevron-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
    color: var(--text-light);
}

.accordion-group.expanded > .accordion-header .chevron-icon {
    transform: rotate(90deg);
}

.accordion-body {
    display: none;
    padding: 1rem 1.5rem 1.5rem 3rem;
    background-color: var(--bg-body);
    border-top: 1px solid var(--border-color);
}

.accordion-group.expanded > .accordion-body {
    display: block;
    animation: fadeIn 0.3s ease;
}

.nested-list {
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--sidebar-bg);
}

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

/* Button */
.btn-primary {
  padding: 0.70rem 0;
  width: 200px;
  background-color: #e5e7eb; /* Default disabled */
  color: var(--text-light);
  border: none;
  font-size: 0.95rem; /* Matched to secondary */
  font-weight: 600;
  cursor: not-allowed;
  transition: all 0.2s ease;
  font-family: inherit;
  border-radius: 4px;
  text-align: center;
}

.btn-primary:not(:disabled) {
  background-color: var(--primary-color);
  color: var(--text-dark); /* Dark text on yellow background fits well */
  cursor: pointer;
}

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

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

.btn-secondary {
  padding: 0.70rem 0;
  width: 200px;
  background-color: #e5e7eb;
  color: var(--text-dark);
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  border-radius: 4px; /* Added matching border radius */
  text-align: center;
}

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

/* Responsive */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    padding: 1rem 0;
    flex-direction: row;
    overflow-x: auto;
  }
  
  .sidebar-nav {
    flex-direction: row;
    width: 100%;
  }
  
  .nav-item {
    padding: 1rem;
    white-space: nowrap;
  }
  
  .header {
    padding: 0 1rem;
  }
  
  .content-card {
    padding: 1.5rem;
  }
  
  .hero-banner {
    padding: 1.5rem;
  }
}

/* Inline Add Brand Form */
.inline-add-brand {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem;
    border: 1px dashed var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-body);
    transition: border-color 0.2s;
}

.inline-add-brand:focus-within {
    border-color: var(--primary-color);
}

.inline-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    padding: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.inline-input:focus {
    outline: none;
    box-shadow: none;
}

.inline-btn {
    padding: 0.5rem 1.5rem;
    font-size: 0.9rem;
    border-radius: 4px;
    min-width: auto;
}

.form-message {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.form-message.hidden {
    display: none;
}

.form-message.success {
    background-color: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.2);
}

.form-message.error {
    background-color: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.2);
}

/* Brand List Actions */
.brand-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-edit {
  display: none;
  color: var(--text-light);
  transition: color 0.2s ease;
  padding: 0.25rem;
  border-radius: 4px;
}

.brand-item:hover .btn-edit {
  display: block;
}

.btn-edit:hover {
  color: var(--primary-color);
  background-color: rgba(255, 255, 255, 0.5);
}

/* Brand Details Page Specific Styles */
.details-form .form-group {
    display: flex;
    flex-direction: column;
}

.details-form label {
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.details-form .form-input {
    width: 100%;
    font-family: var(--font-family);
    font-size: 1rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-body);
    color: var(--text-dark);
}

.details-form .form-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Projects Management */
#projects-container {
    background-color: var(--bg-body);
    border-left: 4px solid var(--secondary-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.project-item {
    /* Share base styles with brand item */
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.project-item:hover {
    background-color: var(--bg-body);
}

.project-item .btn-edit {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary-color);
    padding: 0.2rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.project-item:hover .btn-edit {
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-item .btn-edit:hover {
    background-color: rgba(234, 179, 8, 0.1);
}

/* Custom Modal Options */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(43, 48, 59, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-overlay.hidden {
    display: none;
}

.modal-container {
    background-color: var(--bg-card);
    padding: 2.5rem 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    max-width: 420px;
    width: 90%;
    text-align: center;
    animation: modalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-icon {
    background-color: rgba(231, 76, 60, 0.1);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem auto;
}

.modal-title {
    font-family: var(--font-family);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
    letter-spacing: -0.5px;
}

.modal-message {
    color: var(--text-dark);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.modal-actions .btn {
    min-width: 130px;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
}
