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

:root {
    --primary: hsl(222.2, 47.4%, 11.2%);
    --primary-hover: hsl(222.2, 47.4%, 20%);
    --background: hsl(0, 0%, 100%);
    --foreground: hsl(222.2, 84%, 4.9%);
    --muted: hsl(210, 40%, 96.1%);
    --muted-foreground: hsl(215.4, 16.3%, 46.9%);
    --border: hsl(214.3, 31.8%, 91.4%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--foreground);
    background-color: var(--background);
}

/* Sidebar Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 16rem;
    border-right: 1px solid var(--border);
    background-color: var(--background);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
}

.sidebar.collapsed {
    width: 4rem;
}

.sidebar-header {
    height: 4rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}

.sidebar-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .sidebar-title {
    opacity: 0;
    width: 0;
}

.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background-color: var(--muted);
}

.sidebar-toggle .icon-chevron {
    display: block;
}

.sidebar-toggle .icon-menu {
    display: none;
}

.sidebar.collapsed .sidebar-toggle .icon-chevron {
    display: none;
}

.sidebar.collapsed .sidebar-toggle .icon-menu {
    display: block;
}

.sidebar-nav {
    flex: 1;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    border-radius: 0.375rem;
    text-decoration: none;
    color: var(--foreground);
    transition: background-color 0.2s;
    white-space: nowrap;
}

.nav-item:hover {
    background-color: var(--muted);
}

.nav-item.active {
    background-color: var(--muted);
    font-weight: 500;
}

.nav-icon {
    flex-shrink: 0;
}

.nav-label {
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.625rem 0.5rem;
}

.sidebar.collapsed .nav-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 2rem;
}

.app-footer {
    background-color: var(--muted);
    color: var(--muted-foreground);
    text-align: center;
    padding: 1rem;
    margin-top: auto;
}

.app-footer p {
    margin: 0;
}

/* Legacy header styles (kept for compatibility) */
header {
    background-color: var(--primary);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.5rem;
}

header ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

header a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

header a:hover {
    opacity: 0.8;
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
    min-height: calc(100vh - 200px);
}

.container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

h2 {
    color: var(--foreground);
    margin-bottom: 1.5rem;
}

.gradient-title {
    background: linear-gradient(90deg, var(--primary), hsl(222.2, 47.4%, 20%));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

.template-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    background: var(--background);
    cursor: pointer;
}

.card:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: hsl(222.2, 47.4%, 50%);
}

.card h3 {
    color: var(--foreground);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card p {
    color: var(--muted-foreground);
    margin-bottom: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.5rem;
    background-color: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.3s;
}

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

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1.125rem;
}

.btn-secondary {
    background-color: hsl(215, 16.3%, 46.9%);
}

.btn-secondary:hover {
    background-color: hsl(215, 16.3%, 36.9%);
}

.btn-success {
    background-color: #27ae60;
}

.btn-success:hover {
    background-color: #229954;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--foreground);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.validation-actions,
.export-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: var(--muted);
    font-weight: 600;
    color: var(--foreground);
}

tr:hover {
    background-color: #f8f9fa;
}

.admin-sections {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.admin-section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.proposal-section {
    margin-bottom: 2rem;
    padding: 1rem;
    border-left: 4px solid #3498db;
    background-color: #f8f9fa;
}

footer {
    background-color: var(--primary);
    color: white;
    text-align: center;
    padding: 1rem;
    margin-top: 3rem;
}

/* Mobile Menu Button */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 0.375rem;
    padding: 0.5rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.mobile-menu-toggle:hover {
    background-color: var(--primary-hover);
}

/* Mobile overlay to close sidebar when clicking outside */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

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

/* Features Grid Responsive */
@media (max-width: 768px) {
    .features-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .main-wrapper {
        width: 100%;
    }
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    transition: width 0.3s ease;
}

.save-status {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.save-status.success {
    background-color: #27ae60;
    color: white;
    opacity: 1;
}

.save-status.error {
    background-color: #e74c3c;
    color: white;
    opacity: 1;
}

.save-status.info {
    background-color: #3498db;
    color: white;
    opacity: 1;
}

.required {
    color: #e74c3c;
    margin-left: 0.25rem;
}

.form-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-top: 1.5rem;
}

.form-section {
    padding-right: 2rem;
    border-right: 1px solid #e0e0e0;
}

.validation-panel {
    position: sticky;
    top: 1rem;
    height: fit-content;
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.validation-panel h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1.25rem;
}

.validation-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.validation-item.error {
    background-color: #ffe5e5;
    border-left: 4px solid #e74c3c;
    color: #c0392b;
}

.validation-item.warning {
    background-color: #fff3cd;
    border-left: 4px solid #f39c12;
    color: #996800;
}

.validation-success {
    padding: 0.75rem;
    background-color: #d4edda;
    border-left: 4px solid #27ae60;
    border-radius: 4px;
}

.text-muted {
    color: #7f8c8d;
    font-style: italic;
}

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

/* Review page styles */
.review-header {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #e0e0e0;
}

.review-header h1 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 2rem;
}

.review-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.meta-item {
    font-size: 0.95rem;
}

.meta-item strong {
    color: #2c3e50;
    display: block;
    margin-bottom: 0.25rem;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-draft {
    background-color: #e3f2fd;
    color: #1976d2;
}

.status-submitted {
    background-color: #e8f5e9;
    color: #388e3c;
}

.status-under-review {
    background-color: #fff3e0;
    color: #f57c00;
}

.share-section {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
}

.share-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2c3e50;
}

.share-input-group {
    display: flex;
    gap: 0.5rem;
}

.share-input-group input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.review-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.proposal-content {
    padding-right: 2rem;
    border-right: 1px solid #e0e0e0;
}

.field-group {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.field-group:last-child {
    border-bottom: none;
}

.field-group h3 {
    color: #2c3e50;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.field-value-display {
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    color: #333;
    line-height: 1.6;
}

.textarea-display {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    white-space: pre-wrap;
    word-wrap: break-word;
    background: transparent;
}

.not-provided {
    color: #95a5a6;
    font-style: italic;
}

.validation-section {
    margin-bottom: 1rem;
}

.validation-header {
    margin-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
}

.errors-header {
    color: #e74c3c;
}

.warnings-header {
    color: #f39c12;
}

@media (max-width: 768px) {
    .form-layout {
        grid-template-columns: 1fr;
    }
    
    .form-section {
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding-bottom: 2rem;
    }
    
    .validation-panel {
        position: static;
    }
    
    .review-layout {
        grid-template-columns: 1fr;
    }
    
    .proposal-content {
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding-bottom: 2rem;
    }
}
