/* Root variables */
:root {
    --primary-color: #4361ee;
    --primary-dark: #3a56d4;
    --secondary-color: #7209b7;
    --accent-color: #4cc9f0;
    --success-color: #4ade80;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --light-color: #f8fafc;
    --dark-color: #1e293b;
    --gray-color: #64748b;
    --light-gray: #e2e8f0;
    --border-radius: 10px;
    --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Roboto', sans-serif;
    background-color: #f1f5f9;
    color: var(--dark-color);
    line-height: 1.6;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--light-gray);
}

header h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--gray-color);
    max-width: 800px;
    margin: 0 auto;
}

.author {
    font-size: 0.8rem;
    color: var(--dark-color);
    margin: 0 auto;
    text-align: right;
}

/* Main app layout - stacked vertically */
.app-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-bottom: 30px;
}

.card {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 25px;
    margin-bottom: 0;
    transition: var(--transition);
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--light-gray);
    padding-bottom: 15px;
}

.section-header h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.tooltip {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.tooltip i {
    color: var(--gray-color);
    font-size: 1.2rem;
}

.tooltip-text {
    visibility: hidden;
    width: 300px;
    background-color: var(--dark-color);
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.9rem;
    font-weight: normal;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Input section layout for desktop */
.input-layout {
    display: flex;
    gap: 25px;
}

.input-main {
    flex: 2; /* Takes 2/3 of the space (66.66%) */
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0; /* Allows flex item to shrink below content size */
}

.input-sidebar {
    flex: 1; /* Takes 1/3 of the space (33.33%) */
    display: flex;
    flex-direction: column;
    min-width: 300px; /* Minimum width before it starts shrinking significantly */
}

/* Single input section */
.single-input {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark-color);
}

textarea, select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius);
    font-family: 'Roboto', sans-serif;
    font-size: 1rem;
    transition: var(--transition);
}

textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
}

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

.char-count {
    text-align: right;
    font-size: 0.85rem;
    color: var(--gray-color);
    margin-top: 5px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

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

.btn-secondary {
    background-color: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-secondary:hover {
    background-color: #f0f4ff;
}

/* Real-time validation */
.inline-feedback.card {
    margin-top: 0;
}

.validation-status {
    background-color: #f8fafc;
    border-radius: var(--border-radius);
    padding: 15px;
    border: 1px solid var(--light-gray);
}

.status-indicator {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    transition: all 0.3s ease;
    background-color: #64748b;
}

.status-dot.good {
    background-color: #4ade80;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

.status-dot.warning {
    background-color: #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
    animation: pulse 1.5s infinite;
}

.status-dot.bad {
    background-color: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

.status-text {
    font-weight: 500;
}

.vague-phrases h4 {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.phrases-list {
    max-height: 120px;
    overflow-y: auto;
    padding-right: 10px;
}

.real-time-issue {
    background-color: #fee2e2;
    border-left: 3px solid #ef4444;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 4px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideIn 0.3s ease;
}

.real-time-issue i {
    color: #ef4444;
    font-size: 0.8rem;
}

.more-issues {
    font-size: 0.85rem;
    color: var(--gray-color);
    font-style: italic;
    text-align: center;
    padding: 5px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    color: var(--gray-color);
    text-align: center;
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: var(--light-gray);
}

.empty-state.small {
    padding: 15px;
}

.empty-state.small i {
    font-size: 1.5rem;
}

/* Batch upload section (right column) */
.batch-input {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

.upload-area {
    text-align: center;
    padding: 15px;
    border: 2px dashed var(--light-gray);
    border-radius: var(--border-radius);
    transition: var(--transition);
    flex: 1;
}

.upload-area:hover {
    border-color: var(--primary-color);
}

.upload-area i {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.upload-area h3 {
    margin-bottom: 6px;
    color: var(--dark-color);
    font-size: 1.1rem;
}

.upload-area p {
    color: var(--gray-color);
    margin-bottom: 10px;
    font-size: 0.85rem;
    line-height: 1.3;
}

#csv-upload {
    display: block;
    margin: 10px auto 0;
    padding: 6px;
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius);
    background-color: white;
    width: 100%;
    font-size: 0.85rem;
}

.note {
    font-size: 0.85rem;
    color: var(--warning-color);
    margin: 5px 0 15px;
    font-style: italic;
}

/* Sample CSV section */
.sample-csv {
    background-color: #f8fafc;
    padding: 15px;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    flex: 1;
}

.sample-csv h4 {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1rem;
}

.sample-csv pre {
    background-color: white;
    padding: 10px;
    border-radius: var(--border-radius);
    overflow-x: auto;
    margin-bottom: 12px;
    font-size: 0.8rem;
    border: 1px solid var(--light-gray);
    flex: 1;
}

/* Analysis section */
.quality-score {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 30px;
    align-items: center;
    margin-bottom: 30px;
}

.score-circle {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-bg {
    fill: none;
    stroke: var(--light-gray);
}

.score-progress {
    fill: none;
    stroke: var(--primary-color);
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dashoffset 1s ease;
}

.score-text {
    font-size: 1.8rem;
    font-weight: bold;
    fill: var(--dark-color);
}

.score-label {
    margin-top: 10px;
    font-weight: 500;
    color: var(--dark-color);
}

.quality-breakdown h3 {
    margin-bottom: 15px;
}

.dimension {
    display: grid;
    grid-template-columns: 150px 1fr auto;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.dimension-bar {
    height: 10px;
    background-color: var(--light-gray);
    border-radius: 5px;
    overflow: hidden;
}

.dimension-fill {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 5px;
    width: 0%;
    transition: width 1s ease;
}

.dimension-score {
    font-weight: 500;
    min-width: 40px;
}

/* Analysis Details - Side by side layout */
.analysis-details {
    margin-top: 30px;
}

.analysis-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-top: 10px;
}

.analysis-column {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.analysis-column h3 {
    margin: 0 0 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.issues-list, .suggestions-list {
    background-color: #f8fafc;
    border-radius: var(--border-radius);
    padding: 20px;
    min-height: 250px;
    height: 100%;
    overflow-y: auto;
}

.issue-item, .suggestion-item {
    padding: 15px;
    margin-bottom: 15px;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--warning-color);
    background-color: white;
}

.suggestion-item {
    border-left-color: var(--success-color);
}

.issue-title, .suggestion-title {
    font-weight: 500;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.issue-desc, .suggestion-desc {
    font-size: 0.95rem;
    color: var(--gray-color);
}

/* Requirements section (full width, stacked below) */
.requirements-section {
    margin-top: 10px;
}

.list-controls {
    margin-bottom: 20px;
}

.search-box {
    position: relative;
    margin-bottom: 15px;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-color);
}

.search-box input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius);
    font-size: 1rem;
}

.filter-controls {
    display: flex;
    gap: 15px;
}

.filter-controls select {
    flex: 1;
}

.requirements-container {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.requirements-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.requirements-table th {
    background-color: #f8fafc;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: var(--dark-color);
    border-bottom: 2px solid var(--light-gray);
    position: sticky;
    top: 0;
    z-index: 10;
}

.requirements-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--light-gray);
    vertical-align: top;
}

.requirements-table tbody tr {
    cursor: pointer;
    transition: var(--transition);
}

.requirements-table tbody tr:hover {
    background-color: #f8fafc;
}

.requirements-table tbody tr.active {
    background-color: #f0f4ff;
}

.requirements-table .req-text-cell {
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-table {
    text-align: center;
    padding: 40px !important;
}

.type-badge, .priority-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-block;
}

.type-badge.functional {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.type-badge.non-functional {
    background-color: #f0f9ff;
    color: #0c4a6e;
}

.type-badge.business {
    background-color: #f3e8ff;
    color: #7c3aed;
}

.type-badge.user {
    background-color: #fef3c7;
    color: #d97706;
}

.priority-badge.high {
    background-color: #fee2e2;
    color: #dc2626;
}

.priority-badge.medium {
    background-color: #fef3c7;
    color: #d97706;
}

.priority-badge.low {
    background-color: #d1fae5;
    color: #059669;
}

.score-badge {
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    background-color: #f1f5f9;
    color: var(--dark-color);
}

.score-badge.high {
    background-color: #d1fae5;
    color: #059669;
}

.score-badge.medium {
    background-color: #fef3c7;
    color: #d97706;
}

.score-badge.low {
    background-color: #fee2e2;
    color: #dc2626;
}

.export-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid var(--light-gray);
}

.export-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gray-color);
}

.vague-phrase {
    display: inline-block;
    padding: 5px 10px;
    background-color: #fef3c7;
    color: #d97706;
    border-radius: 20px;
    margin: 0 5px 5px 0;
    font-size: 0.9rem;
}

footer {
    text-align: center;
    padding: 20px;
    color: var(--gray-color);
    font-size: 0.9rem;
    border-top: 1px solid var(--light-gray);
    margin-top: 20px;
}

.footer-note {
    font-size: 0.8rem;
    margin-top: 5px;
    color: var(--gray-color);
    opacity: 0.7;
}

/* Responsive design - Progressive reduction */
/* Large tablets and small laptops */
@media (max-width: 1200px) {
    .input-sidebar {
        min-width: 250px;
    }
    
    .upload-area h3 {
        font-size: 1rem;
    }
    
    .upload-area p {
        font-size: 0.8rem;
    }
    
    .sample-csv h4 {
        font-size: 0.95rem;
    }
    
    .sample-csv pre {
        font-size: 0.75rem;
    }
}

/* Tablets */
@media (max-width: 992px) {
    .input-layout {
        flex-direction: row;
        gap: 20px;
    }
    
    .input-sidebar {
        min-width: 220px;
        flex: 0 1 220px; /* Don't grow, can shrink, base width 220px */
    }
    
    .input-main {
        flex: 2 1 600px; /* Grow more, shrink less, larger base width */
    }
    
    .upload-area {
        padding: 12px;
    }
    
    .upload-area i {
        font-size: 1.5rem;
    }
    
    .upload-area h3 {
        font-size: 0.95rem;
    }
    
    .upload-area p {
        font-size: 0.78rem;
        line-height: 1.2;
    }
    
    .sample-csv {
        padding: 12px;
    }
    
    .sample-csv h4 {
        font-size: 0.9rem;
    }
    
    .sample-csv pre {
        font-size: 0.72rem;
        padding: 8px;
    }
    
    #csv-upload {
        padding: 5px;
        font-size: 0.8rem;
    }
    
    /* Stack analysis columns on tablets */
    .analysis-columns {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Medium tablets - Right column continues to shrink */
@media (max-width: 850px) {
    .input-sidebar {
        min-width: 200px;
        flex: 0 1 200px;
    }
    
    .input-main {
        flex: 2 1 500px;
    }
    
    .upload-area h3 {
        font-size: 0.9rem;
    }
    
    .upload-area p {
        font-size: 0.75rem;
        margin-bottom: 8px;
    }
    
    .note {
        font-size: 0.75rem;
        margin: 3px 0 10px;
    }
    
    .sample-csv pre {
        font-size: 0.7rem;
    }
}

/* Small tablets - Stack when right column gets too small */
@media (max-width: 768px) {
    .input-layout {
        flex-direction: column;
        gap: 20px;
    }
    
    .input-main, .input-sidebar {
        width: 100%;
        flex: none;
        min-width: auto;
    }
    
    .batch-input {
        flex-direction: row;
        gap: 20px;
    }
    
    .upload-area, .sample-csv {
        flex: 1;
    }
    
    .upload-area i {
        font-size: 1.8rem;
    }
    
    .upload-area h3 {
        font-size: 1.1rem;
    }
    
    .upload-area p {
        font-size: 0.85rem;
        line-height: 1.3;
    }
    
    .sample-csv h4 {
        font-size: 1rem;
    }
    
    .sample-csv pre {
        font-size: 0.8rem;
        padding: 10px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }

    .button-group {
        flex-direction: column;
    }

    .btn-primary, .btn-secondary {
        width: 100%;
    }

    .dimension {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .dimension-name {
        font-size: 0.9rem;
    }
    
    .quality-score {
        grid-template-columns: 1fr;
        justify-items: center;
    }
    
    #csv-upload {
        padding: 6px;
        font-size: 0.85rem;
    }
}

/* Very small screens - stack everything vertically */
@media (max-width: 576px) {
    .batch-input {
        flex-direction: column;
    }
    
    .upload-area, .sample-csv {
        width: 100%;
    }
    
    .container {
        padding: 15px;
    }
    
    .card {
        padding: 20px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .analysis-columns {
        gap: 15px;
    }
    
    .issues-list, .suggestions-list {
        min-height: 200px;
        padding: 15px;
    }
}
