/* ============================================
   Work Instruction Generator V2
   Kocer Consulting + Engineering
   ============================================ */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --kocer-blue: #1a5fa4;
    --kocer-orange: #f7941d;
    --kocer-dark: #1a365d;
    --kocer-light: #4a9fd4;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-light: #f8fafc;
    --border-color: #e5e7eb;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, var(--kocer-dark) 0%, #2d3748 100%);
    min-height: 100vh;
    padding: 20px;
    padding-bottom: 40px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

/* Header with Kocer Branding */
header {
    text-align: center;
    color: white;
    margin-bottom: 24px;
}

.brand-header {
    margin-bottom: 16px;
}

.header-logo {
    max-width: 200px;
    height: auto;
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.subtitle {
    opacity: 0.85;
    font-size: 1rem;
    color: var(--kocer-orange);
    font-weight: 500;
}

/* Status Indicator */
.status {
    padding: 10px 20px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
    font-weight: 500;
}

.status-checking {
    background: #fef3c7;
    color: #92400e;
}

.status-connected {
    background: #d1fae5;
    color: #065f46;
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
}

/* Sections */
section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 16px;
}

section h2 {
    font-size: 1.1rem;
    color: var(--kocer-dark);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--kocer-orange);
}

/* Form Elements */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 500px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

input[type="text"],
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--kocer-blue);
}

/* Steps Section */
.steps-section {
    background: var(--bg-light);
}

#stepsContainer {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

/* Step Card */
.step-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--kocer-dark);
    color: white;
}

.step-number {
    font-weight: 600;
    font-size: 0.95rem;
}

.remove-step-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 4px 8px;
}

.remove-step-btn:hover {
    opacity: 1;
}

.step-content {
    padding: 14px;
}

.input-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.input-row textarea {
    flex: 1;
    resize: vertical;
    min-height: 70px;
}

.dictate-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--kocer-blue);
    background: white;
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.dictate-btn:hover {
    background: #eff6ff;
}

.dictate-btn.listening {
    background: #ef4444;
    border-color: #ef4444;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Photos Section */
.photos-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.photos-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.photo-thumbnail {
    position: relative;
    width: 70px;
    height: 70px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border-color);
}

.photo-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-thumbnail .remove-photo {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-photo-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #f3f4f6;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.add-photo-btn:hover {
    background: #e5e7eb;
    border-color: var(--kocer-blue);
}

/* Options */
.options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    cursor: pointer;
}

.options input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--kocer-blue);
}

/* Buttons */
.primary-btn {
    width: 100%;
    padding: 16px 24px;
    background: var(--kocer-blue);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
}

.primary-btn:hover {
    background: #14487d;
}

.primary-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.secondary-btn {
    padding: 10px 18px;
    background: #f3f4f6;
    color: var(--text-primary);
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.secondary-btn:hover {
    background: #e5e7eb;
}

#addStepBtn {
    width: 100%;
    padding: 14px;
    border: 2px dashed #cbd5e1;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
}

#addStepBtn:hover {
    background: #f1f5f9;
    border-color: var(--kocer-blue);
    color: var(--kocer-dark);
}

/* Output Section */
.output-section {
    background: white;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.output-header h2 {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.output-actions {
    display: flex;
    gap: 10px;
}

.output-content {
    padding: 0;
    background: white;
    max-height: 600px;
    overflow-y: auto;
    font-size: 0.95rem;
    line-height: 1.7;
}

/* Professional Document Output */
.doc-container {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.doc-header {
    background: linear-gradient(135deg, var(--kocer-dark) 0%, #2d4a6d 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.doc-header img {
    height: 40px;
    filter: brightness(0) invert(1);
}

.doc-header-text h3 {
    font-size: 1.3rem;
    margin-bottom: 4px;
}

.doc-header-text p {
    opacity: 0.85;
    font-size: 0.9rem;
}

.doc-meta {
    background: var(--bg-light);
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    font-size: 0.9rem;
}

.doc-meta span {
    color: var(--text-secondary);
}

.doc-meta strong {
    color: var(--text-primary);
}

.doc-body {
    padding: 20px;
}

.doc-section {
    margin-bottom: 24px;
}

.doc-section:last-child {
    margin-bottom: 0;
}

.doc-section h4 {
    color: var(--kocer-dark);
    font-size: 1.1rem;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--kocer-orange);
}

.doc-section p {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.doc-section ul,
.doc-section ol {
    margin-left: 20px;
    margin-bottom: 12px;
}

.doc-section li {
    margin-bottom: 8px;
    color: var(--text-primary);
}

.doc-step {
    background: var(--bg-light);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    border-left: 4px solid var(--kocer-blue);
}

.doc-step-header {
    font-weight: 600;
    color: var(--kocer-dark);
    margin-bottom: 8px;
    font-size: 1rem;
}

.doc-step-content {
    color: var(--text-primary);
}

.doc-step-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.doc-step-photos img {
    max-width: 150px;
    max-height: 120px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    object-fit: cover;
}

.doc-warning {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 12px;
}

.doc-warning strong {
    color: #92400e;
}

.doc-quality {
    background: #d1fae5;
    border-left: 4px solid #10b981;
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 12px;
}

.doc-quality strong {
    color: #065f46;
}

.doc-note {
    background: #eff6ff;
    border-left: 4px solid var(--kocer-blue);
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

/* Original Input Reference */
.doc-reference {
    background: #f9fafb;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-top: 20px;
}

.doc-reference h5 {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.doc-reference ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.doc-reference li {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    padding-left: 16px;
    position: relative;
}

.doc-reference li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--kocer-orange);
}

.doc-footer {
    background: var(--kocer-dark);
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

.doc-footer img {
    height: 24px;
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

.doc-footer span {
    opacity: 0.8;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--kocer-orange);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loadingText {
    font-size: 1.1rem;
}

/* App Footer */
.app-footer {
    text-align: center;
    padding: 24px;
    margin-top: 24px;
    color: white;
}

.footer-logo {
    height: 32px;
    filter: brightness(0) invert(1);
    opacity: 0.9;
    margin-bottom: 8px;
}

.app-footer p {
    margin: 4px 0;
    opacity: 0.9;
}

.app-footer .footer-sub {
    font-size: 0.85rem;
    opacity: 0.7;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
    body {
        padding: 12px;
    }
    
    .header-logo {
        max-width: 160px;
    }
    
    header h1 {
        font-size: 1.4rem;
    }
    
    section {
        padding: 16px;
    }
    
    .options {
        flex-direction: column;
        gap: 12px;
    }
    
    .output-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .output-actions {
        width: 100%;
    }
    
    .output-actions button {
        flex: 1;
    }
    
    .doc-header {
        flex-direction: column;
        text-align: center;
    }
    
    .doc-meta {
        flex-direction: column;
        gap: 8px;
    }
    
    .doc-footer {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }
    
    .container {
        max-width: none;
    }
    
    header, .status, .metadata-section, .steps-section, 
    .options-section, .primary-btn, .loading, .output-header,
    .app-footer {
        display: none !important;
    }
    
    .output-section {
        box-shadow: none;
        margin: 0;
    }
    
    .output-content {
        max-height: none;
        overflow: visible;
    }
}
/* ============================================
   Login Screen
   ============================================ */

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    max-width: 180px;
    margin-bottom: 24px;
}

.login-container h1 {
    color: var(--kocer-dark);
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.login-form {
    text-align: left;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .primary-btn {
    margin-top: 8px;
}

.login-error {
    color: #dc2626;
    font-size: 0.9rem;
    text-align: center;
    margin-top: 16px;
    padding: 10px;
    background: #fee2e2;
    border-radius: 8px;
}

.login-footer {
    margin-top: 32px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Logged in user display */
.user-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    color: white;
}

.user-info span {
    font-size: 0.9rem;
}

.logout-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}