/* SOW Generator - CONCERTIUM Design System */

:root {
    /* Light mode (default) */
    --bg-gradient-start: #1a1f3a;
    --bg-gradient-end: #0f1729;
    --container-bg: #ffffff;
    --primary-accent: #4a9eff;
    --primary-accent-hover: #3a8eef;
    --text-primary: #1a1f3a;
    --text-secondary: #475569;
    --section-bg: #f8fafc;
    --border-color: #e2e8f0;
    --input-bg: #ffffff;
    --error-color: #ef4444;
    --success-color: #22c55e;
}

[data-theme="dark"] {
    --container-bg: #1a1f3a;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --section-bg: #0f1729;
    --border-color: #334155;
    --input-bg: #0f1729;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.theme-icon {
    font-size: 20px;
}

/* Container */
.container {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--container-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

h1 {
    font-size: 28px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-align: center;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 14px;
}

/* Form Sections */
.form-section {
    background: var(--section-bg);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid var(--primary-accent);
}

.form-section h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.form-section h2::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--primary-accent);
    border-radius: 50%;
    margin-right: 10px;
}

.section-hint {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.form-section h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    margin-top: 5px;
}

.form-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-accent);
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* Form Groups */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-group small {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Inputs */
input[type="text"],
input[type="date"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-accent), #3a8eef);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #3a8eef, #2a7edf);
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.4);
}

.btn-secondary {
    background: #64748b;
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-danger {
    background: var(--error-color);
    color: white;
    padding: 6px 12px;
    font-size: 12px;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Dynamic List Items (Phases, Deliverables, Assumptions) */
.dynamic-item {
    background: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
}

.dynamic-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.dynamic-item-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-accent);
}

.phase-tasks {
    margin-top: 10px;
    padding-left: 15px;
}

.task-item {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.task-item input {
    flex: 1;
}

.simple-item {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.simple-item input {
    flex: 1;
}

/* Data Tables */
.table-container {
    overflow-x: auto;
    margin-bottom: 15px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border: 1px solid var(--border-color);
}

.data-table th {
    background: var(--primary-accent);
    color: white;
    font-weight: 500;
}

.data-table tbody tr:nth-child(even) {
    background: var(--section-bg);
}

.data-table input {
    width: 100%;
    border: 1px solid var(--border-color);
}

.data-table .action-col {
    width: 60px;
    text-align: center;
}

.total-row {
    background: var(--section-bg) !important;
    font-weight: 600;
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.form-actions .btn-danger {
    margin-right: auto;
    padding: 10px 20px;
    font-size: 14px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--container-bg);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.modal-header h2 {
    font-size: 20px;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

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

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Preview Content */
.preview-section {
    margin-bottom: 20px;
}

.preview-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-accent);
    margin-bottom: 8px;
}

.preview-section p {
    font-size: 14px;
    color: var(--text-primary);
}

.preview-list {
    list-style: none;
    padding-left: 0;
}

.preview-list li {
    padding: 4px 0;
    font-size: 14px;
    color: var(--text-primary);
}

.preview-list li::before {
    content: '•';
    color: var(--primary-accent);
    margin-right: 8px;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 2000;
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(-50%) translateY(0);
}

.notification.success {
    background: var(--success-color);
}

.notification.error {
    background: var(--error-color);
}

/* Loading State */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Project Total Summary */
.project-total-summary {
    background: var(--container-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-top: 15px;
}

.total-line {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.total-line:last-child {
    border-bottom: none;
}

.total-line.grand-total {
    margin-top: 10px;
    padding-top: 15px;
    border-top: 2px solid var(--primary-accent);
    border-bottom: none;
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-accent);
}

/* Select styling */
select {
    padding: 8px 10px;
    font-size: 13px;
    min-width: 100px;
}

/* Fees/Materials line total */
.svc-line-total,
.mat-line-total {
    font-weight: 500;
    white-space: nowrap;
}
