/* ===================================
   Ghost AI - Admin Stylesheet
   Monochromatic Dark Mode Design
   Author: Bitghost
   =================================== */

:root {
    --ghost-black: #000000;
    --ghost-white: #ffffff;
    --ghost-gray-100: #0a0a0a;
    --ghost-gray-200: #141414;
    --ghost-gray-300: #1e1e1e;
    --ghost-gray-400: #2a2a2a;
    --ghost-gray-500: #3f3f3f;
    --ghost-gray-600: #5a5a5a;
    --ghost-gray-700: #7a7a7a;
    --ghost-gray-800: #a0a0a0;
    --ghost-border: #2a2a2a;
    --ghost-border-width: 2px;
    --ghost-radius: 8px;
    --ghost-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    --ghost-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================================
   Reset & Base Styles
   =================================== */

.ghost-ai-wrapper {
    background: var(--ghost-black);
    color: var(--ghost-white);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    padding: 20px;
    min-height: 100vh;
    line-height: 1.6;
}

.ghost-ai-wrapper * {
    box-sizing: border-box;
}

/* ===================================
   Header
   =================================== */

.ghost-ai-header {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: var(--ghost-border-width) solid var(--ghost-border);
}

.ghost-ai-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ghost-icon {
    font-size: 32px;
    display: inline-block;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.ghost-ai-logo h1 {
    margin: 0;
    font-size: 32px;
    font-weight: 700;
    color: var(--ghost-white);
}

.ghost-ai-tagline {
    margin-top: 8px;
    color: var(--ghost-gray-700);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid;
    animation: shimmer 3s ease-in-out infinite;
}

.user-status-badge.logged-in {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border-color: #22c55e;
}

.user-status-badge.guest {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: #ef4444;
}

/* ===================================
   Shimmering Moodbox
   =================================== */

.ghost-ai-moodbox {
    position: relative;
    background: var(--ghost-gray-100);
    border: var(--ghost-border-width) solid var(--ghost-border);
    border-radius: var(--ghost-radius);
    padding: 40px;
    margin-bottom: 30px;
    overflow: hidden;
}

.moodbox-shimmer {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.moodbox-content {
    position: relative;
    z-index: 1;
}

.moodbox-title {
    font-size: 24px;
    margin: 0 0 24px 0;
    font-weight: 600;
}

/* ===================================
   Prompt Area
   =================================== */

.prompt-area {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ghost-prompt-input {
    width: 100%;
    background: var(--ghost-gray-200);
    border: var(--ghost-border-width) solid var(--ghost-border);
    border-radius: var(--ghost-radius);
    padding: 16px;
    color: var(--ghost-white);
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    transition: var(--ghost-transition);
}

.ghost-prompt-input:focus {
    outline: none;
    border-color: var(--ghost-gray-500);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.ghost-prompt-input::placeholder {
    color: var(--ghost-gray-600);
}

.prompt-actions {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

/* ===================================
   File Upload
   =================================== */

.file-upload-area {
    flex: 1;
    min-width: 200px;
}

.file-upload-btn {
    display: inline-block;
    background: var(--ghost-gray-300);
    border: var(--ghost-border-width) solid var(--ghost-border);
    border-radius: var(--ghost-radius);
    padding: 12px 20px;
    color: var(--ghost-white);
    cursor: pointer;
    transition: var(--ghost-transition);
    font-weight: 500;
}

.file-upload-btn:hover {
    background: var(--ghost-gray-400);
    border-color: var(--ghost-gray-500);
}

.file-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--ghost-gray-200);
    border: 1px solid var(--ghost-border);
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
}

.file-item-name {
    color: var(--ghost-gray-800);
}

.file-item-remove {
    background: none;
    border: none;
    color: var(--ghost-white);
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    opacity: 0.6;
    transition: var(--ghost-transition);
}

.file-item-remove:hover {
    opacity: 1;
}

/* ===================================
   Buttons
   =================================== */

.ghost-btn-primary {
    background: var(--ghost-white);
    color: var(--ghost-black);
    border: none;
    border-radius: var(--ghost-radius);
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--ghost-transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.ghost-btn-primary:hover {
    background: var(--ghost-gray-800);
    transform: translateY(-2px);
    box-shadow: var(--ghost-shadow);
}

.ghost-btn-primary:active {
    transform: translateY(0);
}

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

.ghost-btn-secondary {
    background: var(--ghost-gray-300);
    color: var(--ghost-white);
    border: var(--ghost-border-width) solid var(--ghost-border);
    border-radius: var(--ghost-radius);
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--ghost-transition);
}

.ghost-btn-secondary:hover {
    background: var(--ghost-gray-400);
    border-color: var(--ghost-gray-500);
}

.ghost-btn-load-more {
    width: 100%;
    background: var(--ghost-gray-200);
    color: var(--ghost-white);
    border: var(--ghost-border-width) solid var(--ghost-border);
    border-radius: var(--ghost-radius);
    padding: 20px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--ghost-transition);
    margin-top: 30px;
}

.ghost-btn-load-more:hover {
    background: var(--ghost-gray-300);
    border-color: var(--ghost-gray-500);
    transform: translateY(-2px);
}

/* ===================================
   AI Suggestions
   =================================== */

.ai-suggestions {
    margin-top: 32px;
    padding-top: 32px;
    border-top: var(--ghost-border-width) solid var(--ghost-border);
}

.suggestions-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    color: var(--ghost-gray-700);
    font-size: 14px;
    font-weight: 500;
}

.suggestion-icon {
    font-size: 18px;
}

.suggestions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.suggestion-item {
    background: var(--ghost-gray-200);
    border: var(--ghost-border-width) solid var(--ghost-border);
    border-radius: var(--ghost-radius);
    padding: 16px;
    cursor: pointer;
    transition: var(--ghost-transition);
    font-size: 14px;
}

.suggestion-item:hover {
    background: var(--ghost-gray-300);
    border-color: var(--ghost-gray-500);
    transform: translateY(-2px);
}

.suggestion-loader {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: var(--ghost-gray-700);
}

/* ===================================
   Dashboard
   =================================== */

.ghost-ai-dashboard {
    margin-top: 30px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.dashboard-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

/* ===================================
   Generation Progress
   =================================== */

.generation-progress {
    position: relative;
    background: var(--ghost-gray-100);
    border: var(--ghost-border-width) solid var(--ghost-border);
    border-radius: var(--ghost-radius);
    padding: 40px;
    text-align: center;
    margin-bottom: 30px;
    overflow: hidden;
}

.progress-shimmer {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    animation: shimmer 2s ease-in-out infinite;
}

.progress-content {
    position: relative;
    z-index: 1;
}

.progress-icon {
    font-size: 48px;
    margin-bottom: 16px;
    animation: spin 2s linear infinite;
}

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

.progress-content h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    color: var(--ghost-white);
}

.progress-timer {
    margin: 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--ghost-white);
}

.timer-label {
    color: var(--ghost-gray-700);
    margin-right: 8px;
}

.timer-value {
    font-family: 'Courier New', monospace;
    color: var(--ghost-white);
}

.token-info {
    margin: 12px 0;
    font-size: 14px;
    color: var(--ghost-gray-700);
}

.token-label {
    margin-right: 8px;
}

.token-value {
    color: var(--ghost-gray-800);
    font-weight: 600;
}

.generation-status {
    margin-top: 16px;
    font-size: 14px;
    color: var(--ghost-gray-800);
    text-align: center;
}

.status-text {
    display: inline-block;
    padding: 6px 12px;
    background: var(--ghost-gray-200);
    border-radius: 4px;
}

.progress-bar {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: var(--ghost-gray-300);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto;
}

.progress-fill {
    height: 100%;
    background: var(--ghost-white);
    animation: progressFlow 1.5s ease-in-out infinite;
    transition: width 0.5s ease;
}

.progress-fill.waiting {
    background: var(--ghost-gray-600);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes progressFlow {
    0% { width: 20%; margin-left: 0; }
    50% { width: 40%; margin-left: 30%; }
    100% { width: 20%; margin-left: 80%; }
}

/* ===================================
   Artifacts Container
   =================================== */

.artifacts-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 24px;
}

.artifact-card {
    background: var(--ghost-gray-100);
    border: var(--ghost-border-width) solid var(--ghost-border);
    border-radius: var(--ghost-radius);
    overflow: hidden;
    transition: var(--ghost-transition);
    display: flex;
    flex-direction: column;
    position: relative;
}

.artifact-card:hover {
    border-color: var(--ghost-gray-500);
    transform: translateY(-4px);
    box-shadow: var(--ghost-shadow);
}

.artifact-delete-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: var(--ghost-gray-300);
    border: 2px solid var(--ghost-border);
    border-radius: 4px;
    color: var(--ghost-white);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: var(--ghost-transition);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
}

.artifact-delete-btn:hover {
    background: #ef4444;
    border-color: #ef4444;
    opacity: 1;
    transform: scale(1.1);
}

.artifact-preview {
    background: var(--ghost-gray-200);
    padding: 20px;
    min-height: 200px;
    border-bottom: var(--ghost-border-width) solid var(--ghost-border);
    font-family: 'Courier New', monospace;
    font-size: 13px;
    overflow: auto;
    max-height: 300px;
}

.artifact-preview code {
    color: var(--ghost-gray-800);
}

.artifact-info {
    padding: 16px;
    flex-grow: 1;
}

.artifact-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.artifact-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--ghost-gray-700);
    margin-bottom: 12px;
}

.artifact-actions {
    display: flex;
    gap: 8px;
    padding: 16px;
    border-top: var(--ghost-border-width) solid var(--ghost-border);
}

.artifact-btn {
    flex: 1;
    background: var(--ghost-gray-300);
    border: var(--ghost-border-width) solid var(--ghost-border);
    border-radius: var(--ghost-radius);
    padding: 10px;
    color: var(--ghost-white);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--ghost-transition);
}

.artifact-btn:hover {
    background: var(--ghost-gray-400);
    border-color: var(--ghost-gray-500);
}

/* ===================================
   Modal (Caffeine AI Style)
   =================================== */

.ghost-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: relative;
    background: var(--ghost-gray-100);
    border: var(--ghost-border-width) solid var(--ghost-border);
    border-radius: var(--ghost-radius);
    width: 100%;
    max-width: 1000px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--ghost-shadow);
    z-index: 1;
}

.modal-container.dragging {
    cursor: move;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: var(--ghost-border-width) solid var(--ghost-border);
    cursor: move;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--ghost-white);
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--ghost-transition);
}

.modal-close:hover {
    color: var(--ghost-gray-600);
}

.modal-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: var(--ghost-border-width) solid var(--ghost-border);
    background: var(--ghost-gray-200);
}

.file-count {
    color: var(--ghost-gray-700);
    font-size: 14px;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

/* ===================================
   File Explorer
   =================================== */

.file-explorer {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.file-explorer-item {
    background: var(--ghost-gray-200);
    border: var(--ghost-border-width) solid var(--ghost-border);
    border-radius: var(--ghost-radius);
    overflow: hidden;
}

.file-explorer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--ghost-gray-300);
    cursor: pointer;
    transition: var(--ghost-transition);
}

.file-explorer-header:hover {
    background: var(--ghost-gray-400);
}

.file-explorer-title {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-icon {
    font-size: 16px;
}

.file-explorer-content {
    padding: 16px;
    background: var(--ghost-gray-100);
    font-family: 'Courier New', monospace;
    font-size: 13px;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
    border-top: var(--ghost-border-width) solid var(--ghost-border);
}

.file-explorer-content pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.file-explorer-content code {
    color: var(--ghost-gray-800);
}

/* ===================================
   Toast Notifications
   =================================== */

.ghost-toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.ghost-toast {
    background: var(--ghost-gray-100);
    border: var(--ghost-border-width) solid var(--ghost-border);
    border-radius: var(--ghost-radius);
    padding: 16px 20px;
    box-shadow: var(--ghost-shadow);
    animation: toastSlideIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 12px;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-icon {
    font-size: 24px;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 14px;
    color: var(--ghost-gray-700);
}

.ghost-toast.success {
    border-color: #22c55e;
}

.ghost-toast.error {
    border-color: #ef4444;
}

.ghost-toast.info {
    border-color: #3b82f6;
}

/* ===================================
   Settings Page
   =================================== */

.ghost-ai-settings-container {
    max-width: 800px;
}

.ghost-settings-form {
    background: var(--ghost-gray-100);
    border: var(--ghost-border-width) solid var(--ghost-border);
    border-radius: var(--ghost-radius);
    padding: 30px;
}

.settings-section {
    margin-bottom: 40px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.section-header {
    margin-bottom: 24px;
}

.section-header h2 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
}

.section-description {
    color: var(--ghost-gray-700);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

.section-description a {
    color: var(--ghost-white);
    text-decoration: underline;
}

.settings-field {
    margin-bottom: 24px;
}

.field-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
}

.status-active {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.status-inactive {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.api-key-input-group {
    display: flex;
    gap: 8px;
}

.api-key-input {
    flex: 1;
    background: var(--ghost-gray-200);
    border: var(--ghost-border-width) solid var(--ghost-border);
    border-radius: var(--ghost-radius);
    padding: 12px 16px;
    color: var(--ghost-white);
    font-size: 14px;
    font-family: 'Courier New', monospace;
}

.api-key-input:focus {
    outline: none;
    border-color: var(--ghost-gray-500);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.toggle-visibility-btn {
    background: var(--ghost-gray-300);
    border: var(--ghost-border-width) solid var(--ghost-border);
    border-radius: var(--ghost-radius);
    padding: 12px 16px;
    cursor: pointer;
    transition: var(--ghost-transition);
    font-size: 18px;
}

.toggle-visibility-btn:hover {
    background: var(--ghost-gray-400);
}

.field-help {
    margin-top: 8px;
    font-size: 13px;
    color: var(--ghost-gray-700);
}

.test-result {
    margin-top: 12px;
    padding: 12px;
    border-radius: var(--ghost-radius);
    font-size: 14px;
}

.test-loading {
    color: var(--ghost-gray-700);
}

.test-success {
    color: #22c55e;
}

.test-error {
    color: #ef4444;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.info-item {
    background: var(--ghost-gray-200);
    border: var(--ghost-border-width) solid var(--ghost-border);
    border-radius: var(--ghost-radius);
    padding: 16px;
}

.info-label {
    display: block;
    color: var(--ghost-gray-700);
    font-size: 12px;
    margin-bottom: 4px;
}

.info-value {
    font-weight: 600;
    font-size: 14px;
}

.info-value a {
    color: var(--ghost-white);
    text-decoration: none;
    transition: var(--ghost-transition);
}

.info-value a:hover {
    text-decoration: underline;
}

.security-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.security-item {
    display: flex;
    gap: 16px;
    background: var(--ghost-gray-200);
    border: var(--ghost-border-width) solid var(--ghost-border);
    border-radius: var(--ghost-radius);
    padding: 20px;
}

.security-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.security-content h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
}

.security-content p {
    margin: 0;
    font-size: 14px;
    color: var(--ghost-gray-700);
    line-height: 1.5;
}

.settings-actions {
    display: flex;
    gap: 12px;
    padding-top: 24px;
    border-top: var(--ghost-border-width) solid var(--ghost-border);
}

/* ===================================
   Responsive Design
   =================================== */

@media (max-width: 768px) {
    .ghost-ai-wrapper {
        padding: 12px;
    }
    
    .ghost-ai-moodbox {
        padding: 20px;
    }
    
    .prompt-actions {
        flex-direction: column;
    }
    
    .suggestions-grid {
        grid-template-columns: 1fr;
    }
    
    .artifacts-container {
        grid-template-columns: 1fr;
    }
    
    .modal-container {
        max-width: 100%;
        max-height: 90vh;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   Utility Classes
   =================================== */

.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 16px;
}

.mb-4 {
    margin-bottom: 16px;
}
