@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;700&display=swap');

:root {
  --background-dark: #000000;
  --background-light: #1e1e1e;
  --primary: #2a2a2a;
  --secondary: #e94560;
  --accent-blue: #00bcd4;
  --text-primary: #ffffff;
  --text-secondary: #a7a9be;
  --border-radius: 8px;
  --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  --sidebar-width: 260px;
}

html[data-theme="light"] {
  --background-dark: #f4f6f8;
  --background-light: #ffffff;
  --primary: #e5e7eb;
  --secondary: #e94560;
  --accent-blue: #00bcd4;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
}

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

svg {
    width: 25px;
    height: 25px;
}

html, body, #root {
  height: 100%;
}

body {
  font-family: 'Vazirmatn', sans-serif;
  background-color: var(--background-dark);
  color: var(--text-primary);
  line-height: 1.6;
  overscroll-behavior-y: contain;
  overflow-x: hidden; /* Prevent horizontal scroll on the main page */
}

/* Ensure all form elements inherit the body font */
input, button, select, textarea {
  font-family: inherit;
}

/* Login Page Styles */
.login-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background-color: var(--background-dark);
}

.login-main {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
}

.login-box {
    background-color: var(--background-light);
    padding: 3rem;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 450px;
    border: 1px solid var(--primary);
    box-shadow: var(--box-shadow);
    text-align: center;
}
.login-box h2 {
    margin-bottom: 2rem;
    font-size: 1.8rem;
}
.login-btn {
    width: 100%;
    background-color: var(--secondary);
    color: var(--text-primary);
    border: none;
    border-radius: var(--border-radius);
    padding: 0.9rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 1rem;
    transition: background-color 0.3s ease;
}
.login-btn:hover {
    background-color: #d83a56;
}
.login-error {
    color: var(--secondary);
    margin-top: 1rem;
    font-size: 0.9rem;
}

.auth-toggle {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-toggle button {
    background: none;
    border: none;
    color: var(--secondary);
    cursor: pointer;
    font-weight: 500;
    padding: 0 0.25rem;
    font-family: inherit;
    font-size: inherit;
    vertical-align: baseline;
}

.auth-toggle button:hover {
    text-decoration: underline;
}

.link-button {
    background: none;
    border: none;
    color: var(--accent-blue);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    font-family: inherit;
}

.link-button:hover {
    text-decoration: underline;
    color: var(--secondary);
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--text-secondary);
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--primary);
}
.auth-divider:not(:empty)::before {
    margin-left: .5em;
}
.auth-divider:not(:empty)::after {
    margin-right: .5em;
}

.secondary-auth-btn {
    width: 100%;
    background-color: transparent;
    color: var(--accent-blue);
    border: 1px solid var(--accent-blue);
    border-radius: var(--border-radius);
    padding: 0.9rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}
.secondary-auth-btn:hover {
    background-color: rgba(0, 188, 212, 0.1);
}

.login-message {
    color: #26a69a;
    background-color: rgba(38, 166, 154, 0.1);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    border: 1px solid rgba(38, 166, 154, 0.2);
    font-size: 0.95rem;
    line-height: 1.6;
}

html[data-theme="light"] .login-message {
    color: #0d5c54;
}

.login-footer {
    flex-shrink: 0;
    text-align: center;
    padding: 1.5rem 1rem;
    width: 100%;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.full-page-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    background-color: var(--background-dark);
}

/* Verification Page Styles */
.verify-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100vh;
    padding: 1rem;
    background-color: var(--background-dark);
}
.verify-box {
    background-color: var(--background-light);
    padding: 3rem;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 500px;
    border-top: 4px solid var(--text-secondary);
    box-shadow: var(--box-shadow);
    text-align: center;
    transition: border-color 0.3s ease;
}
.verify-icon {
    margin-bottom: 1.5rem;
}
.verify-box h2 {
    font-size: 1.2rem;
    line-height: 1.7;
    color: var(--text-primary);
}
.verify-link {
    color: var(--accent-blue);
    text-decoration: none;
    margin-top: 1.5rem;
    display: inline-block;
    font-weight: 500;
}
.verify-link:hover {
    text-decoration: underline;
}
.spinner {
  width: 48px;
  height: 48px;
  border: 5px solid var(--primary);
  border-bottom-color: var(--accent-blue);
  border-radius: 50%;
  display: inline-block;
  box-sizing: border-box;
  animation: rotation 1s linear infinite;
}
@keyframes rotation {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.app-container {
  display: flex;
  width: 100%;
  height: 100%;
}

.content-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Fix for flexbox overflow issues */
}

.sidebar {
  width: var(--sidebar-width);
  background-color: var(--background-light);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-left: 1px solid var(--primary);
  transition: width 0.3s ease;
  flex-shrink: 0;
}

.sidebar-header {
  margin-bottom: 2rem;
  text-align: center;
}

.sidebar-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-header h1 span {
  color: var(--secondary);
}

.sidebar-header .app-logo, .login-box .app-logo {
    max-height: 50px;
    width: auto;
    object-fit: contain;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.sidebar-nav .create-bot-btn {
    margin-top: 1rem;
}

.nav-item {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.3s ease, background-color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    border-radius: var(--border-radius);
    text-align: right;
}

.nav-item:hover {
    background-color: var(--primary);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--accent-blue);
    color: var(--text-primary);
    font-weight: 700;
}

.nav-item svg {
    flex-shrink: 0;
}

.notification-badge {
    background-color: var(--secondary);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
}

.main-top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: var(--background-light);
    border-bottom: 1px solid var(--primary);
    flex-shrink: 0;
}
.main-top-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

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

.hamburger-menu {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: none;
}

.hamburger-menu svg {
    width: 28px;
    height: 28px;
}

.main-top-header .theme-toggle-btn {
    background: var(--primary);
    border: none;
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: color 0.3s ease, background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.main-top-header .theme-toggle-btn:hover {
    background-color: var(--accent-blue);
    color: var(--text-primary);
}

.user-menu {
    position: relative;
}
.user-menu-trigger {
    background-color: var(--primary);
    border: none;
    color: var(--text-primary);
    height: 40px;
    padding: 0 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.user-menu-trigger:hover {
    box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.08);
}
.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    background-color: var(--background-light);
    border: 1px solid var(--primary);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 200px;
    z-index: 101;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.user-menu-dropdown.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.user-menu-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    width: 100%;
    text-align: right;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.95rem;
    transition: color 0.2s ease, background-color 0.2s ease;
}
.user-menu-dropdown-item:hover {
    background-color: var(--primary);
    color: var(--text-primary);
}
.user-menu-dropdown-item.logout {
    color: var(--secondary);
    border-top: 1px solid var(--primary);
}
.user-menu-dropdown-item.logout:hover {
     background-color: rgba(233, 69, 96, 0.1);
}


.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    z-index: 1099;
    display: none;
}

.main-content {
  flex-grow: 1;
  padding: 2rem 3rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

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

.main-header h2 {
  font-size: 2rem;
  font-weight: 700;
}

.main-header .create-bot-btn {
    width: auto;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.main-footer {
    margin-top: auto;
    padding-top: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* Notification Bar */
.notification-bar {
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-primary);
    width: 100%;
    font-size: 0.9rem;
}

.notification-bar.info {
    background-color: var(--accent-blue);
    color: #ffffff;
}
html[data-theme="dark"] .notification-bar.info {
    background-color: #004a54;
    color: #b2ebf2;
}

.notification-bar.warning {
    background-color: #ffb74d; /* Material Orange 300 */
    color: #000000;
}
html[data-theme="dark"] .notification-bar.warning {
    background-color: #4d3822;
    color: #ffe0b2; /* Material Orange 100 */
}

.notification-bar.error {
    background-color: var(--secondary);
    color: #ffffff;
}
html[data-theme="dark"] .notification-bar.error {
    background-color: #5d1c25;
    color: #f8d7da; /* Bootstrap red-light */
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-grow: 1;
}

.notification-action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid currentColor;
    color: inherit;
    padding: 0.3rem 0.8rem;
    border-radius: 5px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
    font-size: 0.85rem;
}
.notification-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}
html[data-theme="dark"] .notification-bar.warning .notification-action-btn {
    background: rgba(0, 0, 0, 0.2);
}
html[data-theme="dark"] .notification-bar.warning .notification-action-btn:hover {
    background: rgba(0, 0, 0, 0.3);
}


.notification-close-btn {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
    padding: 0 0.5rem;
}
.notification-close-btn:hover {
    opacity: 1;
}

/* Styles for the global notification slider */
.notification-content.notification-slider-container {
    height: 1.2em;
    overflow: hidden;
    /* Override flex properties that might interfere */
    display: block;
    position: relative;
    padding: 0;
    margin: 0;
    /* flex-grow is already on .notification-content, which is fine */
}

.notification-slider {
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    position: absolute; /* Relative to the container */
    width: 100%;
}

.notification-slide-item {
    display: block;
    height: 1.2em;
    line-height: 1.2em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}