/* Projects Base Styles - shadcn/ui inspired design system */
/* Shared styles for all project pages. Import before page-specific CSS. */

/* ============================================
   1. CSS Variables
   ============================================ */
:root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --primary: 222.2 47.4% 11.2%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 222.2 84% 4.9%;
    --radius: 0.5rem;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
}

/* ============================================
   2. Back Button
   ============================================ */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: hsl(var(--muted-foreground));
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 8px 12px;
    background: hsl(var(--muted));
    border-radius: var(--radius);
    transition: background 0.2s, color 0.2s;
    margin-bottom: 32px;
}

.back-btn:hover {
    background: hsl(var(--secondary));
    color: hsl(var(--foreground));
}

.back-btn svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   3. Page Header
   ============================================ */
.page-header {
    text-align: left;
    margin-bottom: 32px;
}

.page-header h1 {
    margin: 0;
    font-size: 1.875rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: hsl(var(--primary));
}

.page-header p {
    margin: 8px 0 0 0;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

/* ============================================
   4. Buttons
   ============================================ */
.btn {
    height: 40px;
    padding: 0 16px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}

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

.btn svg {
    width: 16px;
    height: 16px;
}

.btn .spinner {
    animation: spin 1s linear infinite;
}

/* Primary button */
.btn-primary {
    color: hsl(var(--primary-foreground));
    background: hsl(var(--primary));
    border: none;
    transition: opacity 0.2s;
}

.btn-primary:hover:not(:disabled) {
    opacity: 0.9;
}

.btn-primary.processing {
    background: hsl(var(--muted-foreground));
}

/* Outline button */
.btn-outline {
    color: hsl(var(--foreground));
    background: transparent;
    border: 1px solid hsl(var(--input));
    transition: background 0.2s, border-color 0.2s;
}

.btn-outline:hover:not(:disabled) {
    background: hsl(var(--accent));
    border-color: hsl(var(--accent));
}

/* Destructive button */
.btn-destructive {
    color: hsl(var(--destructive-foreground));
    background: hsl(var(--destructive));
    border: none;
    transition: opacity 0.2s;
}

.btn-destructive:hover:not(:disabled) {
    opacity: 0.9;
}

.btn-destructive:focus-visible {
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--destructive));
}

.btn-destructive.processing {
    background: hsl(var(--muted-foreground));
}

/* Full-width button modifier */
.btn-full {
    width: 100%;
    height: 44px;
}

.btn-full svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   5. Form Controls
   ============================================ */

/* Input Section (card container for inputs) */
.input-section {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    margin-bottom: 16px;
}

/* Form Section (card container for forms) */
.form-section {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    margin-bottom: 16px;
}

/* Input Group */
.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    margin-bottom: 8px;
}

.input-group input[type="text"] {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    font-size: 0.875rem;
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    outline: none;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.input-group input[type="text"]:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.input-group input[type="text"]::placeholder {
    color: hsl(var(--muted-foreground));
}

.input-hint {
    margin: 8px 0 0 0;
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

/* Form Group */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    margin-bottom: 8px;
}

.form-group input[type="text"] {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    font-size: 0.875rem;
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    outline: none;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.form-group input[type="text"]:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.form-group input[type="text"]::placeholder {
    color: hsl(var(--muted-foreground));
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

/* Filter Section */
.filter-section {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    margin-bottom: 16px;
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    letter-spacing: normal;
    text-transform: none;
}

.filter-group select {
    height: 40px;
    padding: 0 32px 0 12px;
    font-size: 0.875rem;
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    outline: none;
    background: hsl(var(--background)) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 12px center;
    cursor: pointer;
    min-width: 100px;
    font-family: inherit;
    color: hsl(var(--foreground));
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-group select:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

/* ============================================
   6. Progress
   ============================================ */
.progress-section {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: hsl(var(--secondary));
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: hsl(var(--primary));
    border-radius: 9999px;
    transition: width 0.3s ease;
}

.progress-text {
    margin-top: 8px;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    text-align: center;
}

/* ============================================
   7. Result Summary
   ============================================ */
.result-summary {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.summary-item {
    flex: 1;
    min-width: 100px;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 12px 16px;
    text-align: center;
}

.summary-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    margin-bottom: 4px;
}

.summary-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

/* ============================================
   8. Result List
   ============================================ */
.result-list-container {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.result-list-container h3 {
    margin: 0 0 16px 0;
    font-size: 1rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.result-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-item {
    padding: 12px 16px;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--background));
}

.result-company {
    font-weight: 600;
    color: hsl(var(--foreground));
    margin-bottom: 8px;
}

/* ============================================
   9. Legend
   ============================================ */
.legend {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: hsl(var(--muted));
    border-radius: var(--radius);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: hsl(var(--foreground));
}

.legend-item .symbol {
    font-size: 1rem;
    font-weight: 600;
    width: 20px;
    text-align: center;
}

.legend-item .symbol.circle {
    color: hsl(142 76% 36%);
    font-size: 1.15rem;
}

.legend-item .symbol.triangle {
    color: hsl(45 93% 37%);
}

.legend-item .symbol.x {
    color: hsl(0 84% 50%);
}

.legend-item .symbol.dash {
    color: hsl(var(--muted-foreground));
}

.legend-item .symbol.sharepoint {
    color: hsl(200 80% 50%);
}

.legend-item .symbol.na {
    color: hsl(var(--muted-foreground));
}

/* ============================================
   10. Status Badge
   ============================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
}

.status-badge.pending {
    background: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
}

.status-badge.processing {
    background: hsl(48 96% 89%);
    color: hsl(25 95% 53%);
}

.status-badge.success {
    background: hsl(142 76% 90%);
    color: hsl(142 76% 36%);
}

.status-badge.failed {
    background: hsl(0 84% 92%);
    color: hsl(0 84% 60%);
}

.status-badge.skipped {
    background: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
}

/* ============================================
   11. Company List Table (base, no grid-template-columns)
   ============================================ */
.company-list-container {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    overflow: hidden;
}

.company-list-header {
    display: grid;
    padding: 12px 16px;
    background: hsl(var(--muted));
    border-bottom: 1px solid hsl(var(--border));
    font-weight: 500;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.company-list-item {
    display: grid;
    padding: 12px 16px;
    border-bottom: 1px solid hsl(var(--border));
    transition: background 0.15s ease;
    align-items: center;
    font-size: 0.875rem;
}

.company-list-item:last-child {
    border-bottom: none;
}

.company-list-item:hover {
    background: hsl(var(--muted) / 0.5);
}

.col-num {
    color: hsl(var(--muted-foreground));
    font-weight: 500;
    font-size: 0.75rem;
}

.col-name {
    font-weight: 500;
    color: hsl(var(--foreground));
}

/* ============================================
   12. Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: 64px 24px;
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    background: hsl(var(--muted));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state-icon svg {
    width: 24px;
    height: 24px;
    color: hsl(var(--muted-foreground));
}

.empty-state h3 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.empty-state p {
    margin: 0;
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
}

/* ============================================
   13. Modal
   ============================================ */
.modal {
    display: none;
    position: fixed;
    z-index: 50;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: hsl(var(--foreground) / 0.8);
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    animation: dialogIn 0.2s ease-out;
}

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

.modal-header h2 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: hsl(var(--muted-foreground));
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: var(--radius);
    transition: background 0.2s, color 0.2s;
}

.close-btn:hover {
    background: hsl(var(--muted));
    color: hsl(var(--foreground));
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(85vh - 65px);
}

/* ============================================
   14. Info Section
   ============================================ */
.info-section {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 20px;
}

.info-section h3 {
    margin: 0 0 12px 0;
    font-size: 1rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.info-section h4 {
    margin: 20px 0 8px 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.info-hint {
    margin: 0 0 16px 0;
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    opacity: 0.8;
}

.doc-type-list {
    margin: 0;
    padding: 0 0 0 20px;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.doc-type-list li {
    margin: 6px 0;
}

.doc-type-list strong {
    color: hsl(var(--foreground));
}

.date-info {
    margin: 0 0 8px 0;
    font-size: 0.875rem;
    color: hsl(var(--primary));
    font-weight: 500;
}

.validation-rules {
    margin: 0;
    padding: 0 0 0 20px;
    font-size: 0.8rem;
    color: hsl(var(--muted-foreground));
}

.validation-rules li {
    margin: 4px 0;
}

.validation-rules strong {
    color: hsl(var(--foreground));
}

/* ============================================
   15. File Link
   ============================================ */
.file-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: hsl(var(--foreground));
    text-decoration: none;
    font-size: 0.875rem;
    padding: 4px 8px;
    background: hsl(var(--secondary));
    border-radius: var(--radius);
    transition: background 0.15s;
}

.file-link:hover {
    background: hsl(var(--accent));
}

.file-link svg {
    width: 14px;
    height: 14px;
}

/* ============================================
   16. Animations
   ============================================ */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes dialogIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* ============================================
   17. Responsive Base
   ============================================ */
@media (max-width: 768px) {
    .page-header h1 {
        font-size: 1.5rem;
    }

    .filter-section {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 16px;
    }

    .result-summary {
        flex-direction: column;
    }

    .summary-item {
        min-width: auto;
    }

    .legend {
        flex-direction: column;
        gap: 8px;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
}
