/* ==========================================================================
   OOBE AI - Shared Styles (custom.css)
   Loaded on every page via layouts.
   ========================================================================== */

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

/* ---------- Base ---------- */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}
body.dark-mode {
    background: #1a1a1a;
    color: #e0e0e0;
}

/* ---------- Scrollbar (Webkit) ---------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}
body.dark-mode ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}
body.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ---------- Scrollbar (Firefox) ---------- */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}
body.dark-mode * {
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* ==========================================================================
   Header
   ========================================================================== */
.header {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s, border-color 0.2s;
}
body.dark-mode .header {
    background: #2a2a2a;
    border-bottom-color: #3a3a3a;
}
.header-logo {
    max-height: 40px;
    width: auto;
}
.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.nav-links {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}
.nav-link {
    padding: 0.5rem 1rem;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.2s;
}
body.dark-mode .nav-link {
    color: #e0e0e0;
}
.nav-link:hover {
    background: #f0f0f0;
}
body.dark-mode .nav-link:hover {
    background: #3a3a3a;
}

/* ==========================================================================
   Dark Mode Toggle
   ========================================================================== */
.dark-mode-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.dark-mode-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}
.dark-mode-icon {
    width: 16px;
    height: 16px;
    stroke: #666;
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.3s;
}
body.dark-mode .dark-mode-icon {
    stroke: #b0b0b0;
}
.dark-mode-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    background: #ccc;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s;
    border: none;
    padding: 0;
    flex-shrink: 0;
}
.dark-mode-toggle::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
body.dark-mode .dark-mode-toggle {
    background: #0078d4;
}
body.dark-mode .dark-mode-toggle::after {
    transform: translateX(20px);
}

/* ==========================================================================
   Logout Button
   ========================================================================== */
.logout-btn {
    padding: 0.5rem;
    background: #333;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    width: 36px;
    height: 36px;
}
.logout-btn:hover {
    background: #555;
}
.logout-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}
body.dark-mode .logout-btn {
    background: #444;
}
body.dark-mode .logout-btn:hover {
    background: #666;
}

/* ==========================================================================
   Modal
   ========================================================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
body.dark-mode .modal-content {
    background: #2a2a2a;
    color: #e0e0e0;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}
body.dark-mode .modal-header {
    border-bottom-color: #3a3a3a;
}
.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}
.modal-close:hover {
    background: #f0f0f0;
}
body.dark-mode .modal-close {
    color: #b0b0b0;
}
body.dark-mode .modal-close:hover {
    background: #3a3a3a;
}

/* ---------- Form elements (used in modals) ---------- */
.form-group {
    padding: 1.5rem;
}
.form-group:not(:last-child) {
    border-bottom: 1px solid #e0e0e0;
}
body.dark-mode .form-group:not(:last-child) {
    border-bottom-color: #3a3a3a;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}
body.dark-mode .form-group label {
    color: #e0e0e0;
}
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    background: white;
    color: #333;
    font-family: inherit;
}
body.dark-mode .form-group input,
body.dark-mode .form-group textarea {
    background: #1a1a1a;
    border-color: #555;
    color: #e0e0e0;
}
.form-group textarea {
    resize: vertical;
    min-height: 80px;
}
.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #666;
    font-size: 0.875rem;
}
body.dark-mode .form-group small {
    color: #999;
}
.form-actions {
    padding: 1.5rem;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    border-top: 1px solid #e0e0e0;
}
body.dark-mode .form-actions {
    border-top-color: #3a3a3a;
}
.btn-primary, .btn-secondary {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary {
    background: #333;
    color: white;
}
.btn-primary:hover {
    background: #555;
}
body.dark-mode .btn-primary {
    background: #444;
}
body.dark-mode .btn-primary:hover {
    background: #666;
}
.btn-secondary {
    background: #f0f0f0;
    color: #333;
}
.btn-secondary:hover {
    background: #e0e0e0;
}
body.dark-mode .btn-secondary {
    background: #3a3a3a;
    color: #e0e0e0;
}
body.dark-mode .btn-secondary:hover {
    background: #4a4a4a;
}

/* ==========================================================================
   Chat Cards (moved here to load last and prevent overrides)
   ========================================================================== */
.chat-card {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 0.5rem 1rem !important;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    height: fit-content !important;
    max-height: none !important;
    min-height: auto !important;
    align-self: start;
}
body.dark-mode .chat-card {
    background: #2a2a2a;
    border-color: rgba(255, 255, 255, 0.1);
}
.chat-card h3 {
    margin: 0 0 0.125rem 0 !important;
    font-size: 0.9375rem !important;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2 !important;
    flex-shrink: 0;
}
.chat-card-meta {
    font-size: 0.75rem;
    color: #999;
    margin-top: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
body.dark-mode .chat-card-meta {
    color: #666;
}

/* ==========================================================================
   Fonts
   ========================================================================== */
   .chat-title {
    font-weight: 300;
}