/* Google Fonts - League Spartan */
@import url('https://fonts.googleapis.com/css2?family=League+Spartan:wght@400;500;600;700&display=swap');

:root {
    --background: #1b1919;
    --primary: #FFFFFF;
    --secondary: #D2D4DA;
    --third: #24262e;
    --border-light: rgba(255, 255, 255, 0.1);
    --border-medium: rgba(255, 255, 255, 0.2);
    --border-heavy: rgba(255, 255, 255, 0.3);
    --overlay-light: rgba(255, 255, 255, 0.05);
    --overlay-medium: rgba(255, 255, 255, 0.1);
    --shadow-light: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 8px rgba(0, 0, 0, 0.2);
    --shadow-heavy: 0 10px 30px rgba(0, 0, 0, 0.25);
    --transition-fast: all 0.2s ease;
    --transition-medium: all 0.3s ease;
}

* { font-family: 'League Spartan', sans-serif; }

body {
    background-color: var(--background);
    color: var(--primary);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Typography - Consolidated */
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    color: var(--primary) !important;
}

label, .form-label, legend, p, span {
    color: var(--primary);
}

.text-muted, .form-text, small, .small {
    color: rgba(255, 255, 255, 0.6) !important;
}

/* Form Controls - Unified Styling */
.form-control, 
.custom-select,
.form-select,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="datetime"],
input[type="datetime-local"],
input[type="month"],
input[type="week"],
input[type="time"],
input[type="url"],
input[type="color"],
input[type="tel"],
textarea,
select {
    background-color: var(--background) !important;
    border: 1px solid var(--border-medium) !important;
    color: var(--primary) !important;
    border-radius: 5px;
    transition: var(--transition-fast);
}

.form-control:focus,
.custom-select:focus,
.form-select:focus,
input:focus,
textarea:focus {
    background-color: var(--background) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.15) !important;
    color: var(--primary) !important;
    outline: none;
}

::placeholder {
    color: rgba(255, 255, 255, 0.4) !important;
}

option {
    background-color: var(--third);
    color: var(--secondary);
}

/* Checkbox and Radio Styling */
.form-check-input {
    background-color: var(--background);
    border: 2px solid rgba(255, 255, 255, 0.5);
    width: 1.1em;
    height: 1.1em;
}

.form-check-input:checked {
    background-color: #007bff;
    border-color: #007bff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}

.form-check-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-check-input:hover {
    border-color: rgba(255, 255, 255, 0.7);
}

.form-check-label {
    color: var(--primary) !important;
    cursor: pointer;
}

/* Date input styling */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* Modal Styles - Consolidated */
.modal-content {
    background-color: var(--third) !important;
    color: var(--primary);
    border: 1px solid var(--border-light);
}

.modal-header {
    border-bottom: 1px solid var(--border-light);
    color: var(--primary);
}

.modal-header .btn-close {
    color: var(--primary);
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
}

.modal-title { color: var(--primary); }
.modal-footer { border-top: 1px solid var(--border-light); }
.modal-body label { color: var(--primary); margin-bottom: 0.5rem; }

/* Modal section styling */
.modal-body h6 {
    color: var(--primary);
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.5rem;
}

.modal-body hr {
    border-color: var(--border-light);
    margin: 1.5rem 0;
}

/* Button Styles - Unified */
.btn-light {
    color: var(--primary);
    background-color: transparent;
    border-color: var(--border-heavy);
}

.btn-light:not(.btn-outline-light) {
    background-color: var(--primary);
    color: var(--background);
    border-color: var(--primary);
}

.btn-light:not(.btn-outline-light):hover {
    background-color: var(--secondary);
    border-color: var(--secondary);
}

.btn-outline-light {
    border-color: var(--border-heavy);
}

.btn-outline-light:hover {
    background-color: var(--overlay-medium);
    color: var(--primary);
}

/* Badge Styles */
.badge { color: var(--primary) !important; }
.badge.bg-secondary { background-color: var(--border-medium) !important; }

/* Status badges */
.status-badge {
    border-width: 1px;
    border-style: solid;
    background-color: transparent !important;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
}

.status-success { border-color: #28a745; color: #28a745 !important; }
.status-info { border-color: #17a2b8; color: #17a2b8 !important; }
.status-warning { border-color: #ffc107; color: #ffc107 !important; }
.status-danger { border-color: #dc3545; color: #dc3545 !important; }
.status-primary { border-color: #007bff; color: #007bff !important; }
.status-secondary { border-color: #6c757d; color: #6c757d !important; }

/* Login Container */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.login-card {
    background-color: var(--third);
    border-radius: 10px;
    padding: 30px;
    width: 400px;
    box-shadow: var(--shadow-medium);
    text-align: center;
}

.login-header {
    color: var(--primary);
    text-align: center;
    margin-bottom: 30px;
}

.login-logo { width: 100px; height: 100px; }

.form-input {
    background-color: var(--background);
    color: var(--primary);
    border: 1px solid var(--secondary);
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 15px;
    width: 100%;
}

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

.login-button {
    background-color: var(--primary);
    color: var(--background);
    border: none;
    border-radius: 5px;
    padding: 10px 15px;
    width: 100%;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition-medium);
}

.login-button:hover { background-color: var(--secondary); }
.error-message { color: #ff6b6b; margin-top: 10px; text-align: center; }

/* Homepage Styles */
.homepage-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.homepage-content {
    text-align: center;
    max-width: 800px;
    padding: 20px;
}

.homepage-content h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 30px;
}

/* Background Elements */
.bg-circle {
    position: fixed;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(64, 66, 82, 0.5) 0%, rgba(35, 35, 35, 0) 70%);
    z-index: -1;
}

.bg-circle-1 { width: 800px; height: 800px; top: -200px; left: -200px; }
.bg-circle-2 { width: 600px; height: 600px; bottom: -150px; right: -150px; }
.bg-circle-3 { 
    width: 300px; 
    height: 300px; 
    top: 40%; 
    left: 40%; 
    background: radial-gradient(circle, rgba(64, 66, 82, 0.3) 0%, rgba(35, 35, 35, 0) 70%);
}

/* Homepage Layout */
.homepage-wrapper {
    width: 100%;
    min-height: calc(100vh - 40px);
    padding: 20px 40px;
}

.homepage-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.homepage-header {
    text-align: center;
    padding: 40px 0;
}

.homepage-logo {
    max-width: 200px;
    margin-bottom: 30px;
}

.welcome-title {
    font-size: 48px;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

/* Search Section */
.search-section {
    max-width: 800px;
    width: 100%;
    margin: 20px auto 60px;
    padding: 0 20px;
}

.search-container { position: relative; width: 100%; }

.search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary);
    opacity: 0.7;
    font-size: 20px;
    pointer-events: none;
}

.search-input {
    background-color: var(--background);
    color: var(--primary);
    border: 2px solid var(--third);
    border-radius: 8px;
    padding: 18px 25px;
    font-size: 18px;
    height: auto;
    transition: var(--transition-medium);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.search-input::placeholder {
    color: var(--secondary);
    opacity: 0.7;
}

/* Projects Section */
.projects-section { margin: 20px 0; width: 100%; }

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

.projects-heading {
    color: var(--primary);
    font-weight: normal;
    font-size: 18px;
    margin-bottom: 0;
    padding-left: 8px;
}

.refresh-button {
    background-color: transparent;
    color: var(--secondary);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.refresh-button:hover {
    background-color: var(--overlay-medium);
    color: var(--primary);
}

.refresh-button:active { transform: rotate(180deg); }

/* Project Grid and Cards */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
}

.project-card {
    background-color: var(--background);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    transition: var(--transition-fast);
    height: 100%;
    cursor: pointer;
}

.project-card:hover {
    box-shadow: var(--shadow-medium);
    transform: translateY(-3px);
    border-color: var(--border-heavy);
}

.project-card .card-body { padding: 25px; }

.project-title {
    color: var(--primary);
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 15px;
}

.project-title-analyze-page {
    color: var(--primary);
    font-size: 30px;
    font-weight: 600;
    margin-bottom: 15px;
}

.project-info { margin-bottom: 10px; }

.project-label {
    color: var(--secondary);
    opacity: 0.8;
    font-size: 14px;
}

.project-value {
    color: var(--primary);
    font-size: 14px;
    margin-left: 5px;
}

.project-keywords {
    font-size: 13px;
    color: var(--secondary);
    opacity: 0.7;
}

/* Create Project Button */
.create-project-btn {
    border-color: var(--primary);
    color: var(--primary);
    font-size: 22px;
    font-weight: bold;
    padding: 0;
    width: 38px;
    height: 38px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    position: relative;
}

.create-project-btn:hover {
    background-color: var(--primary);
    color: var(--background);
}

/* Pagination */
.projects-pagination .page-link {
    background-color: var(--third);
    border-color: var(--border-light);
    color: var(--secondary);
    transition: var(--transition-fast);
}

.projects-pagination .page-link:hover {
    background-color: rgba(64, 66, 82, 0.9);
    color: var(--primary);
    border-color: var(--border-medium);
}

.projects-pagination .page-item.active .page-link {
    background-color: var(--primary);
    color: var(--background);
    border-color: var(--primary);
}

.projects-pagination .page-item.disabled .page-link {
    background-color: rgba(36, 38, 46, 0.6);
    color: rgba(210, 212, 218, 0.4);
    border-color: rgba(255, 255, 255, 0.05);
}

/* Dashboard Layout */
.dashboard-layout {
    display: block;
    width: 100%;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    background-color: var(--background);
}

/* Page Placeholder */
.page-placeholder {
    background-color: var(--overlay-light);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.page-placeholder h1 { color: var(--primary); margin-bottom: 20px; }
.page-placeholder p { color: var(--secondary); max-width: 600px; margin: 0 auto 30px; }
.page-placeholder i { font-size: 60px; color: var(--secondary); margin-bottom: 20px; }

/* Error Page */
.error-content-container {
    background-color: var(--third);
    border-radius: 12px;
    padding: 3.5rem 4rem;
    max-width: 600px;
    text-align: center;
    box-shadow: var(--shadow-heavy);
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    backdrop-filter: blur(10px);
}

.error-icon-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: rgba(255, 70, 70, 0.1);
    margin-bottom: 1.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 70, 70, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(255, 70, 70, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 70, 70, 0); }
}

.error-icon { font-size: 3rem; color: #ff4646; }

.error-code {
    font-size: 5rem;
    font-weight: 800;
    line-height: 1;
    color: var(--primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.05em;
    background: linear-gradient(45deg, var(--primary), #8a8d99);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.error-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.error-separator {
    width: 60%;
    border-color: rgba(210, 212, 218, 0.2);
    margin: 0.5rem auto 1.5rem;
}

.error-description {
    font-size: 1.2rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.error-guidance {
    font-size: 1rem;
    color: var(--secondary);
    font-style: italic;
    margin-bottom: 2rem;
}

.error-actions { display: flex; justify-content: center; margin-top: 1rem; }

.error-button {
    min-width: 160px;
    font-weight: 600;
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    transition: var(--transition-medium);
}

.error-button:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-light);
}

/* Advanced options styling */
.advanced-options-card {
    background-color: var(--third);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1rem;
}

/* Form validation */
.is-invalid { border-color: #dc3545 !important; }
.invalid-feedback { color: #dc3545; font-size: 0.875rem; margin-top: 0.25rem; }

/* Loading state */
.btn-loading { opacity: 0.6; cursor: not-allowed; }

.btn-loading::after {
    content: "";
    display: inline-block;
    width: 1rem;
    height: 1rem;
    margin-left: 0.5rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Step Indicators */
.step-indicator {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--third);
    color: var(--secondary);
    border: 2px solid var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    transition: var(--transition-medium);
}

.step-indicator.active {
    background-color: var(--primary);
    color: var(--background);
    border-color: var(--primary);
}

.step-indicator.completed {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}

.step-label {
    color: var(--secondary);
    font-size: 14px;
    font-weight: 500;
}

.step-label.active {
    color: var(--primary);
    font-weight: 600;
}

.step-separator {
    width: 60px;
    height: 2px;
    background-color: var(--border-medium);
    border: none;
    margin: 0;
}

.step-separator.completed { background-color: #28a745; }

/* Selected Topic Cards */
.selected-topic-card {
    background-color: var(--third);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.selected-topic-card h6 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    border: none;
    padding: 0;
}

.selected-topic-card .text-muted { color: var(--secondary) !important; opacity: 0.8; }
.selected-topic-card .text-success { color: #28a745 !important; }

/* Content container styles moved to sierra-sidebar.css */

/* Responsive Design */
@media (max-width: 768px) {
    .homepage-wrapper { padding: 10px 15px; }
    .welcome-title { font-size: 36px; }
    .search-section { margin: 10px auto 40px; }
    .search-input { padding: 15px 20px; font-size: 16px; }
    .projects-grid { grid-template-columns: 1fr; }
    
    .error-content-container {
        padding: 2rem;
        margin: 0 1rem;
    }
    
    .error-code { font-size: 4rem; }
    .error-title { font-size: 1.8rem; }
    .error-actions { flex-direction: column; gap: 1rem; }
    .error-button { width: 100%; }
    
    .step-indicator { width: 28px; height: 28px; font-size: 12px; }
    .step-label { font-size: 12px; }
    .step-separator { width: 40px; }
    
    .modal-body h6 { font-size: 0.95rem; }
    .modal-body .form-text { font-size: 0.8rem; }
    .modal-body .row .col { margin-bottom: 1rem; }
}