/* Custom styles — supplements Tailwind CDN */

/* Smooth page transitions */
body {
    transition: opacity 0.2s ease-in-out;
}

/* Focus ring consistency */
input:focus,
select:focus,
textarea:focus {
    outline: none;
}

/* Button press effect */
button:active:not(:disabled) {
    transform: scale(0.98);
}

/* Loading spinner */
.spinner {
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

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

/* Toast notifications */
.toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    animation: slideIn 0.3s ease-out;
}

.toast-success {
    background-color: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.toast-error {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Inline edit cells */
.editable-cell {
    cursor: pointer;
    min-height: 1.5em;
}
.editable-cell:hover {
    background-color: #f0fdf4;
}
.editable-cell input,
.editable-cell select {
    width: 100%;
    border: 1px solid #0d9488;
    border-radius: 4px;
    padding: 2px 4px;
    font-size: inherit;
    outline: none;
}
.cell-saving {
    opacity: 0.5;
}

/* Expandable rows */
.expand-row { display: none; }
.expand-row.open { display: table-row; }
.row-toggle { cursor: pointer; background-color: #ffffff; transition: background-color 0.15s; }
.row-toggle:hover { background-color: #f8fafc; }
.row-toggle.row-open { background-color: #f0fdfa; }
.row-toggle td { border-bottom: 1px solid #e5e7eb; }
.expand-row td { border-bottom: 2px solid #0d9488; }
.chevron { transition: transform 0.2s; display: inline-block; color: #9ca3af; font-size: 11px; }
.chevron.open { transform: rotate(90deg); color: #0d9488; }

/* Detail panel inside expanded row */
/* Description column — fixed width with text wrap */
.desc-cell {
    min-width: 200px;
    max-width: 350px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    line-height: 1.4;
}

.detail-container {
    padding: 20px 28px 16px;
    background: linear-gradient(to bottom, #f8fafb, #f1f5f9);
    border-left: 3px solid #0d9488;
    margin: 0;
}
.detail-panel {
    max-width: 100%;
}
.detail-section {
    margin-bottom: 16px;
}
.detail-section:last-of-type {
    margin-bottom: 12px;
}
.detail-section-header {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e5e7eb;
}
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px 20px;
}
.detail-label {
    font-size: 11px;
    font-weight: 500;
    color: #9ca3af;
    margin-bottom: 2px;
}
.detail-value {
    padding: 4px 8px;
    border-radius: 6px;
    min-height: 28px;
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border: 1px solid #f3f4f6;
}
.detail-value-text {
    align-items: flex-start;
    min-height: 36px;
    padding: 6px 10px;
}
.detail-value.editable-cell {
    cursor: pointer;
    border: 1px dashed #d1d5db;
}
.detail-value.editable-cell:hover {
    border-color: #0d9488;
    background-color: #f0fdfa;
}
.detail-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #9ca3af;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
}

/* Dashboard tab toggle */
.tab-btn {
    border-bottom: 2px solid transparent;
    transition: border-color 0.15s, color 0.15s;
}
.tab-active {
    border-bottom-color: #2563eb;
    color: #2563eb;
    font-weight: 600;
}

/* Print styles — requirements page */
@media print {
    nav, #add-req-panel, #add-req-btn, #export-csv-btn, #print-btn,
    .toast, [data-delete-fid], .chevron, .editable-cell:hover {
        display: none !important;
    }
    body {
        background: white !important;
    }
    main {
        padding: 0 !important;
        max-width: 100% !important;
    }
    .expand-row {
        display: none !important;
    }
    .row-toggle {
        cursor: default !important;
        background-color: white !important;
    }
    .row-toggle:hover {
        background-color: white !important;
    }
    table {
        font-size: 11px !important;
    }
    #features-table {
        box-shadow: none !important;
        border: 1px solid #d1d5db !important;
    }
    #print-date {
        display: block !important;
    }
}
