/* ============================================
   5S AUDIT - Аудиты 5S
   Phase 6.3
   ============================================ */

/* ===== Container & Header ===== */

.five-s-container {
    padding: 0;
}

.five-s-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.five-s-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.five-s-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.five-s-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.five-s-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.five-s-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.five-s-btn-secondary {
    background: #f1f5f9;
    color: #475569;
}

.five-s-btn-secondary:hover {
    background: #e2e8f0;
}

.five-s-btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.five-s-btn-success:hover {
    transform: translateY(-1px);
}

.five-s-btn-danger {
    background: #fee2e2;
    color: #dc2626;
}

.five-s-btn-danger:hover {
    background: #fecaca;
}

.five-s-btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

/* ===== Filters ===== */

.five-s-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.five-s-filter-select {
    padding: 8px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    color: #475569;
    background: white;
    cursor: pointer;
    outline: none;
}

.five-s-filter-select:focus {
    border-color: #667eea;
}

/* ===== Audit Cards Grid ===== */

.five-s-audit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.five-s-audit-card {
    background: white;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    border: 1px solid #f1f5f9;
    cursor: pointer;
    transition: all 0.2s ease;
}

.five-s-audit-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border-color: #e2e8f0;
}

.five-s-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.five-s-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.five-s-card-meta {
    font-size: 13px;
    color: #94a3b8;
    margin-top: 4px;
}

.five-s-card-meta span {
    margin-right: 12px;
}

/* Score Badge */
.five-s-score-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}

.five-s-score-badge.score-low {
    background: #fee2e2;
    color: #dc2626;
}

.five-s-score-badge.score-mid {
    background: #fef3c7;
    color: #d97706;
}

.five-s-score-badge.score-high {
    background: #d1fae5;
    color: #059669;
}

.five-s-score-badge.score-none {
    background: #f1f5f9;
    color: #94a3b8;
    font-size: 14px;
}

/* Mini bars for 5S categories */
.five-s-mini-bars {
    display: flex;
    gap: 4px;
    margin: 12px 0;
    height: 24px;
    align-items: flex-end;
}

.five-s-mini-bar {
    flex: 1;
    border-radius: 3px 3px 0 0;
    min-height: 4px;
    transition: height 0.3s ease;
}

.five-s-mini-bar-label {
    font-size: 9px;
    text-align: center;
    color: #94a3b8;
    margin-top: 2px;
}

/* Status badges */
.five-s-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.five-s-status-draft {
    background: #f1f5f9;
    color: #64748b;
}

.five-s-status-in_progress {
    background: #fef3c7;
    color: #d97706;
}

.five-s-status-completed {
    background: #d1fae5;
    color: #059669;
}

/* Action count */
.five-s-card-actions-count {
    font-size: 12px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 10px;
}

/* ===== Empty State ===== */

.five-s-empty {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.five-s-empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
}

.five-s-empty h3 {
    color: #475569;
    margin-bottom: 8px;
    font-size: 18px;
}

.five-s-empty p {
    margin-bottom: 20px;
    font-size: 14px;
}

/* ===== Create Modal ===== */

.five-s-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.five-s-modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.five-s-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
}

.five-s-modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.five-s-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
}

.five-s-modal-body {
    padding: 24px;
}

.five-s-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid #f1f5f9;
}

/* Form fields */
.five-s-form-group {
    margin-bottom: 18px;
}

.five-s-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.five-s-form-input,
.five-s-form-select,
.five-s-form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    color: #1e293b;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.five-s-form-input:focus,
.five-s-form-select:focus,
.five-s-form-textarea:focus {
    border-color: #667eea;
}

.five-s-form-textarea {
    resize: vertical;
    min-height: 60px;
}

/* Template cards */
.five-s-template-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.five-s-template-card {
    padding: 14px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.five-s-template-card:hover {
    border-color: #667eea;
    background: #f8faff;
}

.five-s-template-card.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea10, #764ba210);
}

.five-s-template-card-icon {
    font-size: 28px;
    margin-bottom: 6px;
}

.five-s-template-card-name {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}

.five-s-template-card-count {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

/* ===== Audit Detail View ===== */

.five-s-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.five-s-detail-info {
    flex: 1;
}

.five-s-detail-info h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 6px 0;
}

.five-s-detail-meta {
    font-size: 13px;
    color: #94a3b8;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.five-s-detail-scores {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Progress bar */
.five-s-progress {
    background: #f1f5f9;
    border-radius: 6px;
    height: 8px;
    overflow: hidden;
    margin: 16px 0;
}

.five-s-progress-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.five-s-progress-text {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}

/* ===== Category Accordion ===== */

.five-s-category {
    margin-bottom: 16px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #f1f5f9;
    background: white;
}

.five-s-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.five-s-category-header:hover {
    background: #fafbff;
}

.five-s-category-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.five-s-category-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    color: white;
}

.five-s-category-name {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}

.five-s-category-subtitle {
    font-size: 12px;
    color: #94a3b8;
}

.five-s-category-score {
    display: flex;
    align-items: center;
    gap: 8px;
}

.five-s-category-avg {
    font-size: 18px;
    font-weight: 700;
}

.five-s-category-chevron {
    font-size: 16px;
    color: #94a3b8;
    transition: transform 0.2s;
}

.five-s-category.open .five-s-category-chevron {
    transform: rotate(180deg);
}

.five-s-category-body {
    display: none;
    padding: 0 20px 16px;
}

.five-s-category.open .five-s-category-body {
    display: block;
}

/* ===== Checklist Items ===== */

.five-s-item {
    padding: 14px 0;
    border-bottom: 1px solid #f8fafc;
}

.five-s-item:last-child {
    border-bottom: none;
}

.five-s-item-question {
    font-size: 14px;
    color: #334155;
    margin-bottom: 10px;
    line-height: 1.4;
}

/* Score selector (0-5 buttons) */
.five-s-score-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.five-s-score-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    font-size: 16px;
    font-weight: 700;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.five-s-score-btn:hover {
    border-color: #667eea;
    color: #667eea;
    background: #f8faff;
}

.five-s-score-btn.selected {
    color: white;
    border-color: transparent;
}

.five-s-score-btn.selected.s0 { background: #ef4444; }
.five-s-score-btn.selected.s1 { background: #f97316; }
.five-s-score-btn.selected.s2 { background: #f59e0b; }
.five-s-score-btn.selected.s3 { background: #eab308; }
.five-s-score-btn.selected.s4 { background: #22c55e; }
.five-s-score-btn.selected.s5 { background: #10b981; }

.five-s-score-label {
    font-size: 11px;
    color: #94a3b8;
    margin-left: 8px;
    align-self: center;
}

/* Photo upload */
.five-s-photo-section {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.five-s-photo-box {
    width: 120px;
    text-align: center;
}

.five-s-photo-placeholder {
    width: 120px;
    height: 90px;
    border: 2px dashed #e2e8f0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
    color: #94a3b8;
    flex-direction: column;
    gap: 4px;
}

.five-s-photo-placeholder:hover {
    border-color: #667eea;
    color: #667eea;
    background: #f8faff;
}

.five-s-photo-placeholder .photo-icon {
    font-size: 24px;
}

.five-s-photo-preview {
    width: 120px;
    height: 90px;
    border-radius: 10px;
    object-fit: cover;
    cursor: pointer;
    border: 1px solid #e2e8f0;
}

.five-s-photo-label {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}

/* Comment toggle */
.five-s-comment-toggle {
    font-size: 12px;
    color: #667eea;
    cursor: pointer;
    border: none;
    background: none;
    padding: 4px 0;
    margin-top: 6px;
}

.five-s-comment-area {
    margin-top: 6px;
}

.five-s-comment-area textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    resize: vertical;
    min-height: 50px;
    outline: none;
    box-sizing: border-box;
}

.five-s-comment-area textarea:focus {
    border-color: #667eea;
}

/* ===== Action Items ===== */

.five-s-actions-section {
    margin-top: 24px;
    background: white;
    border-radius: 14px;
    border: 1px solid #f1f5f9;
    overflow: hidden;
}

.five-s-actions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
}

.five-s-actions-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.five-s-action-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid #f8fafc;
}

.five-s-action-item:last-child {
    border-bottom: none;
}

.five-s-action-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
    transition: all 0.2s;
}

.five-s-action-checkbox.checked {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.five-s-action-content {
    flex: 1;
}

.five-s-action-title {
    font-size: 14px;
    color: #334155;
    font-weight: 500;
}

.five-s-action-title.completed {
    text-decoration: line-through;
    color: #94a3b8;
}

.five-s-action-meta {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
    display: flex;
    gap: 12px;
}

.five-s-action-deadline.overdue {
    color: #ef4444;
    font-weight: 600;
}

/* ===== Radar Chart ===== */

.five-s-radar-wrapper {
    display: flex;
    justify-content: center;
    padding: 20px;
}

.five-s-radar-canvas {
    max-width: 360px;
    max-height: 360px;
}

/* ===== Stats View ===== */

.five-s-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.five-s-stats-card {
    background: white;
    border-radius: 14px;
    padding: 20px;
    border: 1px solid #f1f5f9;
}

.five-s-stats-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 16px 0;
}

.five-s-stats-card.full-width {
    grid-column: 1 / -1;
}

/* Summary numbers */
.five-s-stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.five-s-stat-box {
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.five-s-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
}

.five-s-stat-label {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
}

/* Zone rankings */
.five-s-ranking-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.five-s-ranking-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f8fafc;
    gap: 12px;
}

.five-s-ranking-item:last-child {
    border-bottom: none;
}

.five-s-ranking-position {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.five-s-ranking-position.gold {
    background: #fef3c7;
    color: #d97706;
}

.five-s-ranking-position.silver {
    background: #f1f5f9;
    color: #64748b;
}

.five-s-ranking-position.bronze {
    background: #fed7aa;
    color: #c2410c;
}

.five-s-ranking-position.other {
    background: #f8fafc;
    color: #94a3b8;
}

.five-s-ranking-info {
    flex: 1;
}

.five-s-ranking-zone {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.five-s-ranking-date {
    font-size: 12px;
    color: #94a3b8;
}

.five-s-ranking-score {
    font-size: 18px;
    font-weight: 700;
}

/* ===== Responsive ===== */

@media (max-width: 768px) {
    .five-s-audit-grid {
        grid-template-columns: 1fr;
    }

    .five-s-stats-grid {
        grid-template-columns: 1fr;
    }

    .five-s-template-cards {
        grid-template-columns: 1fr;
    }

    .five-s-detail-header {
        flex-direction: column;
    }

    .five-s-score-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .five-s-photo-box {
        width: 100px;
    }

    .five-s-photo-placeholder,
    .five-s-photo-preview {
        width: 100px;
        height: 75px;
    }
}

@media (max-width: 480px) {
    .five-s-header {
        flex-direction: column;
        align-items: stretch;
    }

    .five-s-header-actions {
        justify-content: center;
    }

    .five-s-filters {
        flex-direction: column;
    }

    .five-s-modal {
        max-width: 100%;
        border-radius: 12px;
        margin: 8px;
    }

    .five-s-modal-overlay {
        padding: 8px;
    }

    .five-s-modal-body {
        padding: 16px;
    }

    .five-s-modal-header {
        padding: 16px;
    }

    .five-s-modal-footer {
        padding: 12px 16px;
    }

    .five-s-score-btn {
        width: 44px;
        height: 44px;
        font-size: 15px;
    }

    .five-s-action-checkbox {
        width: 44px;
        height: 44px;
        min-width: 44px;
    }
}
