/* Macy's NorthStar - Styles */
/* Brand Colors: Macy's Red #E21836, Black #000000, White #FFFFFF */

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

:root {
    --macys-red: #E21836;
    --macys-dark-red: #B01228;
    --macys-black: #000000;
    --macys-white: #FFFFFF;
    --macys-gray: #F5F5F5;
    --macys-dark-gray: #333333;
    --macys-border: #DDDDDD;
    --macys-light-gray: #FAFAFA;

    --success-green: #28A745;
    --warning-yellow: #FFC107;
    --error-red: #DC3545;
    --info-blue: #17A2B8;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--macys-light-gray);
    color: var(--macys-dark-gray);
    line-height: 1.6;
    overflow: hidden;
}

/* Screens */
.screen {
    display: none;
    width: 100vw;
    height: 100vh;
}

.screen.active {
    display: block;
}

/* Login Screen */
#loginScreen {
    background: linear-gradient(135deg, var(--macys-red) 0%, var(--macys-dark-red) 100%);
}

#loginScreen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    background: var(--macys-white);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px;
}

.logo-container {
    text-align: center;
    margin-bottom: 2rem;
}

.northstar-logo {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--macys-red);
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

.tagline {
    font-size: 0.95rem;
    color: var(--macys-dark-gray);
    font-weight: 300;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--macys-dark-gray);
}

.form-group input {
    padding: 0.75rem;
    border: 2px solid var(--macys-border);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--macys-red);
}

.error-message {
    color: var(--error-red);
    font-size: 0.875rem;
    min-height: 1.25rem;
    text-align: center;
}

/* Buttons */
.btn-primary {
    background: var(--macys-red);
    color: var(--macys-white);
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
}

.btn-primary:hover:not(:disabled) {
    background: var(--macys-dark-red);
}

.btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

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

.btn-secondary {
    background: var(--macys-white);
    color: var(--macys-red);
    padding: 0.5rem 1rem;
    border: 2px solid var(--macys-red);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: var(--macys-red);
    color: var(--macys-white);
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: transform 0.2s;
}

.btn-icon:hover {
    transform: scale(1.1);
}

.btn-small {
    background: var(--macys-dark-gray);
    color: var(--macys-white);
    padding: 0.25rem 0.75rem;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-small:hover {
    background: var(--macys-red);
}

.btn-send {
    background: var(--macys-red);
    color: var(--macys-white);
    padding: 1rem 2rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    align-self: flex-end;
}

.btn-send:hover:not(:disabled) {
    background: var(--macys-dark-red);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* App Screen Layout */
#appScreen.active {
    display: flex;
    flex-direction: column;
}

.app-header {
    background: var(--macys-red);
    color: var(--macys-white);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-left {
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.app-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.app-subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
}

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

.user-info {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 320px;
    min-width: 250px;
    max-width: 600px;
    background: var(--macys-white);
    border-right: 1px solid var(--macys-border);
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
}

.sidebar-resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    cursor: ew-resize;
    background: transparent;
    z-index: 10;
    transition: background 0.2s;
}

.sidebar-resize-handle:hover {
    background: var(--macys-red);
}

.sidebar-resize-handle.resizing {
    background: var(--macys-red);
}

.sidebar-section h3 {
    font-size: 1.1rem;
    color: var(--macys-dark-gray);
    margin-bottom: 1rem;
}

.status-box {
    background: var(--macys-light-gray);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--macys-border);
}

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

.status-label {
    font-weight: 600;
    color: var(--macys-dark-gray);
}

.status-value {
    color: var(--macys-red);
    font-weight: 600;
}

/* Document Search Styles */
.document-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.doc-search-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--macys-border);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--macys-white);
    color: var(--macys-text);
    transition: all 0.2s ease;
}

.doc-search-input:focus {
    outline: none;
    border-color: var(--macys-red);
    box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.1);
}

.doc-search-input::placeholder {
    color: var(--macys-text-muted);
}

.search-count {
    font-size: 0.75rem;
    color: var(--macys-text-muted);
    white-space: nowrap;
    font-weight: 500;
    display: none;
}

.document-list {
    max-height: 500px;
    overflow-y: auto;
    background: var(--macys-light-gray);
    border-radius: 8px;
    padding: 1rem;
}

.document-item {
    background: var(--macys-white);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    border-left: 3px solid var(--macys-red);
    font-size: 0.85rem;
}

.document-item:last-child {
    margin-bottom: 0;
}

.document-name {
    font-weight: 600;
    color: var(--macys-dark-gray);
    margin-bottom: 0.25rem;
}

.document-meta {
    font-size: 0.75rem;
    color: #666;
}

.placeholder-text {
    color: #999;
    font-style: italic;
    text-align: center;
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--macys-white);
}

.chat-header {
    background: var(--macys-light-gray);
    padding: 1.5rem 2rem;
    border-bottom: 2px solid var(--macys-red);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-left {
    flex: 1;
}

.chat-header h2 {
    font-size: 1.5rem;
    color: var(--macys-dark-gray);
    margin-bottom: 0.5rem;
}

.chat-description {
    font-size: 0.9rem;
    color: #666;
}

/* Download Conversation Button */
.btn-download-conv {
    background: linear-gradient(135deg, var(--info-blue) 0%, #138496 100%);
    color: var(--macys-white);
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn-download-conv:hover {
    background: linear-gradient(135deg, #138496 0%, #117a8b 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-download-conv span {
    font-size: 1.1rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.welcome-message {
    background: linear-gradient(135deg, var(--macys-light-gray) 0%, var(--macys-white) 100%);
    padding: 2rem;
    border-radius: 12px;
    border: 2px solid var(--macys-red);
}

.welcome-message h3 {
    color: var(--macys-red);
    margin-bottom: 1rem;
}

.welcome-message ul {
    margin-left: 1.5rem;
    margin-top: 1rem;
}

.welcome-message li {
    margin-bottom: 0.5rem;
    color: var(--macys-dark-gray);
}

.message {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 80%;
}

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.message.user .message-header {
    color: var(--macys-red);
}

.message.assistant .message-header {
    color: var(--macys-dark-gray);
}

.message-content {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    line-height: 1.6;
}

.message.user .message-content {
    background: var(--macys-red);
    color: var(--macys-white);
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: var(--macys-light-gray);
    color: var(--macys-dark-gray);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 0.75rem;
    color: #999;
}

/* Message Actions */
.message-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.btn-download-message, .btn-download-image, .btn-save-to-docs {
    background: transparent;
    border: 1px solid var(--macys-border);
    color: var(--macys-dark-gray);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.btn-download-message:hover, .btn-download-image:hover {
    background: var(--info-blue);
    color: var(--macys-white);
    border-color: var(--info-blue);
}

.btn-save-to-docs:hover {
    background: var(--success-green);
    color: var(--macys-white);
    border-color: var(--success-green);
}

/* Image in messages */
.message-image {
    max-width: 400px;
    max-height: 400px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.message-image:hover {
    transform: scale(1.02);
}

/* Chat Input */
.chat-input-container {
    border-top: 1px solid var(--macys-border);
    padding: 1.5rem 2rem;
    background: var(--macys-white);
}

.chat-status {
    font-size: 0.85rem;
    color: var(--info-blue);
    margin-bottom: 0.5rem;
    min-height: 1.25rem;
}

.chat-status-text {
    font-size: 0.85rem;
    min-height: 1rem;
}

/* Progress Indicator Styles */
.progress-container {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.progress-bar-wrapper {
    width: 200px;
    height: 12px;
    background: var(--macys-border);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--macys-red) 0%, #d32f2f 100%);
    border-radius: 6px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.progress-text {
    font-size: 0.625rem;
    color: var(--macys-dark-gray);
    font-weight: 400;
    text-align: left;
    white-space: nowrap;
    animation: fadeInOut 0.5s ease-in-out;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translateY(-5px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-input-wrapper {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--macys-border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    transition: border-color 0.3s;
}

.chat-input:focus {
    outline: none;
    border-color: var(--macys-red);
}

.chat-input:disabled {
    background: var(--macys-gray);
    cursor: not-allowed;
}

/* Debug Console */
.debug-console {
    display: none;
    position: fixed;
    bottom: 60px;
    right: 20px;
    width: 600px;
    height: 400px;
    background: var(--macys-black);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    z-index: 1000;
}

.debug-console.visible {
    display: flex;
    flex-direction: column;
}

.debug-header {
    background: var(--macys-dark-gray);
    color: var(--macys-white);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.debug-header h4 {
    font-size: 0.9rem;
}

.debug-controls {
    display: flex;
    gap: 0.5rem;
}

.debug-output {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: #00FF00;
}

.log-entry {
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.log-entry.error {
    color: #FF6B6B;
}

.log-entry.warn {
    color: #FFA500;
}

.log-entry.log {
    color: #00FF00;
}

.log-time {
    color: #888;
}

.log-level {
    font-weight: 600;
}

.log-context {
    color: #6B9FFF;
}

/* Footer */
.app-footer {
    background: var(--macys-dark-gray);
    color: var(--macys-white);
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

#connectionStatus {
    color: var(--success-green);
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--macys-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#loadingText {
    color: var(--macys-white);
    font-size: 1.1rem;
}

/* Sidebar Tabs */
.sidebar-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--macys-border);
    margin-bottom: 1rem;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--macys-light-gray);
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--macys-dark-gray);
    transition: all 0.3s;
}

.tab-btn:hover {
    background: var(--macys-gray);
}

.tab-btn.active {
    background: var(--macys-white);
    border-bottom-color: var(--macys-red);
    color: var(--macys-red);
}

.tab-content {
    display: none;
}

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

/* Conversations List */
.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.conversations-list {
    max-height: 500px;
    overflow-y: auto;
    background: var(--macys-light-gray);
    border-radius: 8px;
    padding: 1rem;
}

.conversation-item {
    background: var(--macys-white);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    border-left: 3px solid var(--macys-red);
    cursor: pointer;
    transition: all 0.2s;
}

.conversation-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateX(2px);
}

.conversation-item:last-child {
    margin-bottom: 0;
}

.conversation-title {
    font-weight: 600;
    color: var(--macys-dark-gray);
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.conversation-meta {
    font-size: 0.75rem;
    color: #666;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.conversation-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.conversation-actions button {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-load {
    background: var(--macys-red);
    color: var(--macys-white);
}

.btn-load:hover {
    background: var(--macys-dark-red);
}

.btn-delete {
    background: #666;
    color: var(--macys-white);
}

.btn-delete:hover {
    background: var(--error-red);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--macys-light-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--macys-red);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--macys-dark-red);
}

/* Document Selection */
.button-group {
    display: flex;
    gap: 0.5rem;
    flex-direction: column;
}

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

.document-header h3 {
    margin: 0;
    font-size: 1rem;
}

.document-checkbox-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.6rem;
    background: var(--macys-white);
    border-left: 2px solid var(--macys-border);
    margin-bottom: 0.35rem;
    border-radius: 3px;
    transition: all 0.2s;
    cursor: pointer;
    gap: 0.5rem;
}

.document-checkbox-item:hover {
    border-left-color: var(--macys-red);
    background: #FAFAFA;
}

.document-checkbox-item.selected {
    border-left-color: var(--macys-red);
    background: #FFF5F7;
}

.document-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--macys-red);
    flex-shrink: 0;
}

.document-checkbox-info {
    flex: 1;
    min-width: 0;
}

.document-checkbox-name {
    font-weight: 600;
    color: var(--macys-dark-gray);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-checkbox-meta {
    font-size: 0.7rem;
    color: #666;
}

.visual-analysis-toggle {
    background: transparent;
    border: 1px solid var(--macys-border);
    border-radius: 3px;
    padding: 0.25rem 0.35rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    flex-shrink: 0;
    opacity: 0.5;
}

.visual-analysis-toggle:hover {
    opacity: 1;
    border-color: var(--info-blue);
    background: rgba(23, 162, 184, 0.1);
}

.visual-analysis-toggle.active {
    opacity: 1;
    border-color: var(--info-blue);
    background: var(--info-blue);
    color: white;
}

/* File Upload Button */
.btn-attach {
    background: var(--macys-white);
    border: 2px solid var(--macys-border);
    color: var(--macys-dark-gray);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-attach:hover {
    background: var(--macys-red);
    color: var(--macys-white);
    border-color: var(--macys-red);
}

.btn-attach:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Attached Files Preview */
.attached-files {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0;
}

.attached-file-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--macys-light-gray);
    border: 1px solid var(--macys-border);
    border-radius: 20px;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.attached-file-chip .file-icon {
    font-size: 1rem;
}

.attached-file-chip .file-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attached-file-chip .remove-file {
    background: none;
    border: none;
    color: var(--error-red);
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    margin-left: 0.25rem;
}

/* File Upload Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--macys-white);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

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

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--macys-dark-gray);
}

.btn-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--macys-dark-gray);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
}

.btn-close:hover {
    color: var(--macys-red);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.upload-zone {
    border: 2px dashed var(--macys-border);
    border-radius: 8px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-zone:hover {
    border-color: var(--macys-red);
    background: var(--macys-light-gray);
}

.upload-zone.drag-over {
    border-color: var(--macys-red);
    background: #FFF5F7;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.upload-hint {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.5rem;
}

.selected-files-list {
    margin-top: 1.5rem;
}

.selected-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--macys-light-gray);
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.selected-file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.selected-file-icon {
    font-size: 1.5rem;
}

.selected-file-details {
    flex: 1;
}

.selected-file-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--macys-dark-gray);
}

.selected-file-size {
    font-size: 0.75rem;
    color: #666;
}

.remove-selected-file {
    background: none;
    border: none;
    color: var(--error-red);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem;
}

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

/* Image Preview in Chat */
.message-image {
    max-width: 300px;
    max-height: 300px;
    border-radius: 8px;
    margin-top: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.message-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.message-file-attachment {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--macys-light-gray);
    border: 1px solid var(--macys-border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.message-file-icon {
    font-size: 1.25rem;
}

/* Generate Image Button */
.button-group-vertical {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-generate-image {
    background: linear-gradient(135deg, #9333ea 0%, #7c3aed 100%);
    color: var(--macys-white);
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-generate-image:hover:not(:disabled) {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    transform: translateY(-1px);
}

.btn-generate-image:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.message-file-icon {
    font-size: 1.25rem;
}

/* Generate Image Button */
.button-group-vertical {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-generate-image {
    background: linear-gradient(135deg, #9333ea 0%, #7c3aed 100%);
    color: var(--macys-white);
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-generate-image:hover:not(:disabled) {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    transform: translateY(-1px);
}

.btn-generate-image:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile Sidebar Toggle */
.mobile-sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: var(--macys-red);
    color: var(--macys-white);
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 999;
    transition: transform 0.2s;
}

.mobile-sidebar-toggle:active {
    transform: scale(0.95);
}

.mobile-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.mobile-sidebar-overlay.active {
    display: block;
}

/* ========================================
   MOBILE RESPONSIVE STYLES
   ======================================== */

/* Tablets and smaller laptops (up to 1024px) */
@media screen and (max-width: 1024px) {
    .app-header {
        padding: 1rem 1.5rem;
    }

    .app-title {
        font-size: 1.5rem;
    }

    .app-subtitle {
        font-size: 0.8rem;
    }

    .chat-messages {
        padding: 1.5rem;
    }

    .sidebar {
        width: 280px;
        min-width: 250px;
    }
}

/* Tablets and large phones (up to 768px) */
@media screen and (max-width: 768px) {
    /* Hide desktop sidebar, show mobile toggle */
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        width: 85%;
        max-width: 350px;
        min-width: unset;
        z-index: 999;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .sidebar.mobile-open {
        left: 0;
    }

    .sidebar-resize-handle {
        display: none; /* Disable resize on mobile */
    }

    .mobile-sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Main content takes full width */
    .main-content {
        flex-direction: column;
    }

    .chat-container {
        width: 100%;
    }

    /* Header adjustments */
    .app-header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .app-title {
        font-size: 1.25rem;
    }

    .app-subtitle {
        font-size: 0.75rem;
    }

    .header-right {
        gap: 0.5rem;
    }

    .user-info {
        display: none; /* Hide username on small screens */
    }

    .btn-secondary {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    /* Chat header */
    .chat-header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .chat-header h2 {
        font-size: 1.25rem;
    }

    .chat-description {
        font-size: 0.85rem;
    }

    .btn-download-conv {
        align-self: flex-start;
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    /* Chat messages */
    .chat-messages {
        padding: 1rem;
    }

    .message {
        max-width: 90%;
    }

    .welcome-message {
        padding: 1.5rem;
    }

    /* Chat input */
    .chat-input-container {
        padding: 1rem;
    }

    .chat-input-wrapper {
        gap: 0.5rem;
    }

    .btn-attach {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }

    .chat-input {
        font-size: 0.95rem;
    }

    .btn-send {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }

    /* Footer */
    .app-footer {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    /* Debug console */
    .debug-console {
        width: 90%;
        height: 50vh;
        bottom: 10px;
        right: 5%;
        left: 5%;
    }

    /* Modal */
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        padding: 1rem;
    }

    .upload-zone {
        padding: 2rem 1rem;
    }

    /* Sidebar sections */
    .sidebar {
        padding: 1rem;
    }

    .document-list {
        max-height: 300px;
    }

    .conversations-list {
        max-height: 300px;
    }
}

/* Phones (up to 480px) */
@media screen and (max-width: 480px) {
    /* Login screen */
    .login-container {
        padding: 2rem 1.5rem;
        width: 95%;
    }

    .northstar-logo {
        font-size: 2rem;
    }

    .tagline {
        font-size: 0.85rem;
    }

    /* Header */
    .app-header {
        padding: 0.6rem 0.75rem;
    }

    .app-title {
        font-size: 1.1rem;
    }

    .app-subtitle {
        font-size: 0.7rem;
    }

    .btn-icon {
        font-size: 1.25rem;
        padding: 0.3rem;
    }

    .btn-secondary {
        padding: 0.35rem 0.7rem;
        font-size: 0.8rem;
    }

    /* Sidebar */
    .sidebar {
        width: 90%;
        max-width: 300px;
    }

    .sidebar-section h3 {
        font-size: 1rem;
    }

    .tab-btn {
        padding: 0.6rem 0.75rem;
        font-size: 0.85rem;
    }

    .document-checkbox-item {
        padding: 0.4rem 0.5rem;
        gap: 0.4rem;
    }

    .document-checkbox-name {
        font-size: 0.75rem;
    }

    .document-checkbox-meta {
        font-size: 0.65rem;
    }

    .document-checkbox-item input[type="checkbox"] {
        width: 14px;
        height: 14px;
    }

    .visual-analysis-toggle {
        padding: 0.2rem 0.3rem;
        font-size: 0.8rem;
    }

    .button-group .btn-primary,
    .button-group .btn-secondary {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    /* Chat */
    .chat-header {
        padding: 0.75rem;
    }

    .chat-header h2 {
        font-size: 1.1rem;
    }

    .chat-description {
        font-size: 0.8rem;
    }

    .btn-download-conv {
        padding: 0.45rem 0.9rem;
        font-size: 0.8rem;
    }

    .btn-download-conv span {
        font-size: 1rem;
    }

    .chat-messages {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .message {
        max-width: 95%;
    }

    .message-content {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }

    .message-header {
        font-size: 0.8rem;
    }

    .message-time {
        font-size: 0.7rem;
    }

    .welcome-message {
        padding: 1.25rem;
    }

    .welcome-message h3 {
        font-size: 1.1rem;
    }

    .welcome-message p,
    .welcome-message li {
        font-size: 0.9rem;
    }

    /* Chat input */
    .chat-input-container {
        padding: 0.75rem;
    }

    .chat-input-wrapper {
        flex-wrap: wrap;
    }

    .btn-attach {
        width: 34px;
        height: 34px;
        font-size: 1.15rem;
    }

    .chat-input {
        font-size: 0.9rem;
        padding: 0.6rem;
        min-height: 80px;
    }

    .btn-send {
        padding: 0.6rem 1.25rem;
        font-size: 0.9rem;
        width: 100%;
        margin-top: 0.5rem;
    }

    .chat-status {
        font-size: 0.8rem;
    }

    /* Attached files */
    .attached-file-chip {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }

    .attached-file-chip .file-name {
        max-width: 100px;
    }

    /* Message actions */
    .message-actions {
        flex-wrap: wrap;
    }

    .btn-download-message,
    .btn-download-image,
    .btn-save-to-docs {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }

    /* Message images */
    .message-image {
        max-width: 100%;
        max-height: 250px;
    }

    /* Footer */
    .app-footer {
        font-size: 0.7rem;
        padding: 0.4rem 0.5rem;
        text-align: center;
    }

    .app-footer span {
        font-size: 0.7rem;
    }

    /* Mobile sidebar toggle */
    .mobile-sidebar-toggle {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
        bottom: 15px;
        right: 15px;
    }

    /* Debug console */
    .debug-console {
        width: 95%;
        height: 60vh;
        bottom: 5px;
        right: 2.5%;
        left: 2.5%;
    }

    .debug-output {
        font-size: 0.7rem;
    }

    /* Modal */
    .modal-content {
        width: 98%;
    }

    .modal-header h3 {
        font-size: 1.1rem;
    }

    .btn-close {
        font-size: 1.75rem;
        width: 28px;
        height: 28px;
    }

    .upload-zone {
        padding: 1.5rem 1rem;
    }

    .upload-icon {
        font-size: 2.5rem;
    }

    .upload-zone p {
        font-size: 0.9rem;
    }

    .upload-hint {
        font-size: 0.75rem;
    }

    /* Status box */
    .status-box {
        padding: 0.75rem;
    }

    .status-item {
        padding: 0.4rem 0;
        font-size: 0.85rem;
    }

    /* Conversations */
    .conversation-item {
        padding: 0.6rem;
    }

    .conversation-title {
        font-size: 0.85rem;
    }

    .conversation-meta {
        font-size: 0.7rem;
    }

    .conversation-actions button {
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
    }

    /* Buttons */
    .btn-small {
        padding: 0.2rem 0.6rem;
        font-size: 0.7rem;
    }

    .btn-generate-image {
        padding: 0.5rem 0.85rem;
        font-size: 0.85rem;
    }
}

/* Landscape orientation tweaks for phones */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .chat-messages {
        padding: 0.75rem;
    }

    .welcome-message {
        padding: 1rem;
    }

    .chat-input {
        min-height: 60px;
    }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .tab-btn {
        min-height: 44px;
    }

    .document-checkbox-item {
        min-height: 44px;
    }

    .conversation-item {
        min-height: 44px;
    }

    button {
        min-height: 44px;
    }

    .btn-small {
        min-height: 36px;
    }

    .btn-icon {
        min-width: 44px;
        min-height: 44px;
    }

    /* Remove hover effects on touch devices */
    .document-checkbox-item:hover {
        border-left-color: var(--macys-border);
        background: var(--macys-white);
    }

    .conversation-item:hover {
        box-shadow: none;
        transform: none;
    }

    .message-image:hover {
        transform: none;
    }
}
