/* ========== Dark Theme Colors ========== */
:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #242424;
    --bg-tertiary: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-muted: #999;
    --border-color: #404040;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
}

/* ========== Reset & Base ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

body {
    min-height: 100vh;
}

.dark-mode {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* ========== Typography ========== */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.5em;
    font-weight: 600;
    color: var(--text-primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    margin-bottom: 1em;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ========== Buttons ========== */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-weight: 500;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-secondary);
    border-color: var(--accent-primary);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.3);
}

.btn-info {
    background-color: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.btn-info:hover {
    background-color: rgba(59, 130, 246, 0.3);
}

.btn-sm {
    padding: 0.45rem 0.9rem;
    font-size: 0.875rem;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: all 0.3s;
}

.btn-icon:hover {
    transform: scale(1.2);
}

.btn-copy {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.5rem;
    color: var(--accent-primary);
    transition: all 0.3s;
}

.btn-copy:hover {
    transform: scale(1.1);
    color: var(--accent-secondary);
}

/* ========== Forms ========== */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    transition: all 0.3s;
    font-family: inherit;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="file"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background-color: var(--bg-secondary);
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder {
    color: var(--text-muted);
}

textarea {
    resize: vertical;
}

.input-group {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-tertiary);
    transition: all 0.3s;
}

.input-group:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-icon {
    padding: 0 1rem;
    font-size: 1.2rem;
    color: var(--text-muted);
}

.input-group input {
    border: none;
    background: transparent;
    padding: 0.75rem 0;
    color: var(--text-primary);
}

.input-group input:focus {
    outline: none;
    box-shadow: none;
}

/* ========== Alerts ========== */
.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    border-left: 4px solid;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-left-color: #ef4444;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border-left-color: #10b981;
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border-left-color: #f59e0b;
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border-left-color: #3b82f6;
}

/* ========== Navbar ========== */
.navbar {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 1.8rem;
}

.navbar-menu {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.navbar-user {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ========== Login Page ========== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-tertiary) 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    border: 1px solid var(--border-color);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.login-form {
    margin: 2rem 0;
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

/* ========== Upload Page ========== */
.upload-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
    padding: 2rem 0;
}

.upload-container {
    width: 100%;
    max-width: 600px;
    padding: 20px;
}

.upload-box {
    background: var(--bg-secondary);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    border: 1px solid var(--border-color);
}

.upload-header {
    text-align: center;
    margin-bottom: 2rem;
}

.upload-header h1 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.project-info {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border-left: 4px solid var(--accent-primary);
}

.project-info h2 {
    margin: 0;
    color: var(--text-primary);
}

.file-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 1.5rem;
    background-color: var(--bg-tertiary);
}

.file-upload-zone:hover,
.file-upload-zone.drag-over {
    border-color: var(--accent-primary);
    background-color: rgba(99, 102, 241, 0.1);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.upload-icon {
    font-size: 3rem;
    margin: 0 auto 1rem;
}

.upload-text {
    font-size: 1.1rem;
    margin: 0;
    color: var(--text-primary);
}

.upload-subtext {
    color: var(--text-muted);
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.file-input-label {
    display: inline-block;
    margin: 1rem 0 0.5rem;
    color: var(--accent-primary);
    font-weight: 500;
    cursor: pointer;
    padding: 0.75rem 1.5rem;
    background-color: rgba(99, 102, 241, 0.2);
    border-radius: 6px;
    transition: all 0.3s;
    border: 1px solid var(--accent-primary);
}

.file-input-label:hover {
    background-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
}

.file-input-label input[type="file"] {
    display: none;
}

.file-name {
    margin-top: 0.75rem;
    color: var(--accent-primary);
    font-size: 0.9rem;
}

.upload-info {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1.5rem;
    border: 1px solid var(--border-color);
}

.upload-info h3 {
    margin-top: 0;
    font-size: 1.1rem;
}

.upload-info ul {
    list-style: none;
    padding: 0;
}

.upload-info li {
    margin-bottom: 0.75rem;
    color: var(--text-muted);
    padding-left: 1.5rem;
    position: relative;
}

.upload-info li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}

/* ========== Progress Bar ========== */
.progress-container {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.progress-bar-wrapper {
    width: 100%;
    height: 24px;
    background: var(--bg-primary);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.5rem;
}

.progress-text {
    text-align: right;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

/* ========== Extraction Loader ========== */
.extraction-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 1rem;
}

.extraction-text {
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0;
}

/* Spinner animation */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* ========== Main Content ========== */
.main-content {
    padding: 2rem 0;
}

/* Centered main wrapper for admin/editor pages */
.centered-main {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 80px);
    padding: 2rem 0;
}

/* Editor box (dark card centered) */
.editor-box {
    width: 100%;
    max-width: 1400px;
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    border: 1px solid var(--border-color);
    margin: 0 auto;
}

/* Ensure inner content aligns nicely */
.editor-box .dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    margin-bottom: 0;
}

/* ========== Projects Grid ========== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    margin-bottom: 0;
}

.project-card {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s;
    border: 1px solid var(--border-color);
}

.project-card:hover {
    box-shadow: 0 12px 28px rgba(99, 102, 241, 0.2);
    transform: translateY(-4px);
    border-color: var(--accent-primary);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.project-header h3 {
    margin: 0;
    flex: 1;
}

.project-menu {
    display: flex;
    gap: 0.5rem;
}

.project-description {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.project-meta {
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
    margin: 1rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ========== Hash Display ========== */
.hash-display {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 6px;
    margin: 1rem 0;
    border: 1px solid var(--border-color);
}

.hash-display label {
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.hash-box {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.hash-box code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: var(--bg-primary);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    flex: 1;
    font-size: 0.8rem;
    color: var(--accent-primary);
    word-break: break-all;
    border: 1px solid var(--border-color);
}

/* ========== Upload Link Section ========== */
.upload-link-section {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 6px;
    margin: 1rem 0;
    border: 1px solid var(--border-color);
}

.upload-link-section label {
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.link-box {
    display: flex;
    gap: 0.5rem;
}

.link-box input {
    flex: 1;
    font-size: 0.85rem;
    padding: 0.5rem;
    background: var(--bg-primary);
}

.link-box button {
    padding: 0.5rem 1rem;
}

/* ========== Uploads List ========== */
.project-uploads {
    margin-top: 1.5rem;
}

.project-uploads h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.uploads-list {
    list-style: none;
    max-height: 250px;
    overflow-y: auto;
}

.uploads-list li {
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
}

.uploads-list span {
    color: var(--text-primary);
}

/* ========== Empty State ========== */
.empty-state {
    background: var(--bg-tertiary);
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border-color);
    margin-top: 1.5rem;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h2 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* ========== Modal ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    border: 1px solid var(--border-color);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.3s;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: var(--text-primary);
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* ========== Notification ========== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(16, 185, 129, 0.9);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 6px;
    z-index: 2000;
    animation: slideInRight 0.3s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========== Responsive Design ========== */
@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .dashboard-header .btn {
        width: 100%;
    }

    .project-header {
        flex-direction: column;
    }

    .project-menu {
        margin-top: 1rem;
    }

    .project-card {
        padding: 1rem;
    }

    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }

    .navbar-menu {
        width: 100%;
        justify-content: space-between;
    }

    .hash-box,
    .link-box {
        flex-direction: column;
    }

    .hash-box .btn-copy,
    .link-box button {
        width: 100%;
    }

    h1 {
        font-size: 1.5rem;
    }

    .modal-content {
        width: 95%;
    }

    .login-box {
        padding: 1.5rem;
    }

    .upload-box {
        padding: 1.5rem;
    }

    .file-upload-zone {
        padding: 2rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .upload-icon {
        font-size: 2.5rem;
    }

    .navbar-menu {
        flex-direction: column;
        gap: 0.5rem;
    }

    .navbar-user {
        font-size: 0.85rem;
    }

    .project-card {
        padding: 1rem;
    }

    .hash-box code {
        font-size: 0.75rem;
    }
}

/* ========== Scrollbar Styling ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

