/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #2d3748;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    padding: 2rem 0;
    text-align: center;
    color: white;
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content h1 i {
    margin-right: 0.5rem;
    color: #ffd700;
}

.header-content p {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding-bottom: 2rem;
}

/* Cards */
.card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}

.card-warning {
    border-left: 4px solid #f56565;
}

.card-compact {
    margin-bottom: 0;
}

.card-compact .card-header {
    padding: 0.75rem 1rem;
}

.card-compact .card-header h2 {
    font-size: 1rem;
}

.card-compact .card-body {
    padding: 0.75rem 1rem;
}

.card-header {
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header h2 i {
    color: #667eea;
}

.card-header p {
    color: #718096;
    font-size: 0.9rem;
    margin: 0.5rem 0 0 0;
    flex-basis: 100%;
}

.card-body {
    padding: 2rem;
}

/* Input Section */
.input-section textarea {
    width: 100%;
    height: 50px;
    min-height: 50px;
    max-height: 50px;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    line-height: 1.4;
    resize: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #fafafa;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.input-section textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
    white-space: normal;
    overflow: auto;
}


.input-section textarea::placeholder {
    color: #a0aec0;
}

.input-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.char-count {
    color: #718096;
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #f7fafc;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
}

.output-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Progress Section */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #e2e8f0;
    transition: all 0.3s ease;
}

.step.active {
    background: #ebf8ff;
    border-left-color: #667eea;
}

.step.completed {
    background: #f0fff4;
    border-left-color: #48bb78;
}

.step i {
    font-size: 1.1rem;
    color: #a0aec0;
    min-width: 20px;
}

.step.active i {
    color: #667eea;
}

.step.completed i {
    color: #48bb78;
}

.step span {
    font-weight: 500;
    color: #4a5568;
}

.progress-messages {
    background: #f7fafc;
    border-radius: 8px;
    padding: 1rem;
    min-height: 100px;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    color: #4a5568;
}

.progress-message {
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
}

.progress-message.info {
    color: #2b6cb0;
}

.progress-message.success {
    color: #2f855a;
}

.progress-message.warning {
    color: #d69e2e;
}

/* SOP Output */
.sop-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f7fafc;
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.sop-section h3 {
    color: #2d3748;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sop-section h3 i {
    color: #667eea;
}

.sop-section .content {
    color: #4a5568;
    line-height: 1.7;
}

.sop-section ul, .sop-section ol {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

.sop-section li {
    margin-bottom: 0.5rem;
}

/* Warning Section */
.warning-content {
    text-align: center;
}

.warning-content p {
    font-size: 1.1rem;
    color: #4a5568;
    margin-bottom: 2rem;
}

.suggestions {
    background: #fffaf0;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    text-align: left;
}

.suggestions h3 {
    color: #c53030;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.suggestions ul {
    list-style: none;
    margin-left: 0;
}

.suggestions li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.suggestions li:before {
    content: "•";
    color: #f56565;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem 0;
    color: white;
    opacity: 0.8;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header-content h1 {
        font-size: 2rem;
    }
    
    .card-header {
        padding: 1rem 1.5rem;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .card-body {
        padding: 1.5rem;
    }
    
    .output-actions {
        justify-content: center;
        width: 100%;
    }
    
    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }
    
    .progress-steps {
        grid-template-columns: 1fr;
    }
    
    .input-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .char-count {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.75rem;
    }
    
    .header-content p {
        font-size: 1rem;
    }
    
    .card-header h2 {
        font-size: 1.1rem;
    }
    
    .input-section textarea {
        min-height: 250px;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mt-1 {
    margin-top: 0.5rem !important;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* SOP Title Styling */
.sop-title {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.sop-title .doc-type {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: #64748b;
    background: #f1f5f9;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}

.sop-title h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    line-height: 1.3;
}

/* Steps with Inline Screenshots */
.steps-with-screenshots {
    counter-reset: step-counter;
    list-style: none;
    padding-left: 0;
}

.steps-with-screenshots .step-item {
    counter-increment: step-counter;
    margin-bottom: 1.5rem;
    padding-left: 2.5rem;
    position: relative;
}

.steps-with-screenshots .step-item::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 1.75rem;
    height: 1.75rem;
    background: #3b82f6;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.step-instruction {
    font-size: 1rem;
    line-height: 1.6;
    color: #1e293b;
    margin-bottom: 0.75rem;
}

.step-screenshot {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.75rem;
}

.screenshot-suggestion {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.screenshot-suggestion i {
    color: #b45309;
    margin-top: 0.15rem;
}

.screenshot-label {
    font-weight: 600;
    color: #92400e;
}

.screenshot-suggestion .screenshot-description {
    color: #78350f;
    flex: 1;
    min-width: 200px;
    line-height: 1.5;
}

.screenshot-placeholder {
    background: white;
    border: 2px dashed #d1d5db;
    border-radius: 6px;
    padding: 1.5rem;
    text-align: center;
    color: #9ca3af;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.screenshot-placeholder i {
    font-size: 1.5rem;
}

.screenshot-placeholder span {
    font-size: 0.875rem;
}

/* PDF Button Styling */
.btn-pdf {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
}

.btn-pdf:hover {
    background: #b91c1c !important;
    border-color: #b91c1c !important;
}

/* PDF Export Optimizations */
@media print {
    .output-actions,
    .header,
    .footer,
    .input-section,
    .progress-section,
    .insufficient-section {
        display: none !important;
    }
    
    .output-section {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: none !important;
    }
    
    .sop-section {
        break-inside: avoid;
    }
    
    .step-item {
        break-inside: avoid;
    }
}