/**
 * instructions-dialog.css
 *
 * Styles for AI Instruction Templates Dialog.
 * Follows DocuShare popup/dialog pattern for consistency.
 *
 * Copyright (c) 2026 Xerox Co. All Rights Reserved.
 */

/* --- BEGIN AI-GENERATED CODE ---
 * Source: Claude Code
 * Model Used: Claude Opus 4.5
 * Human reviewed and approved on 2026-02-10 by US993293
 */

/* Dialog overlay */
.ai-instructions-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9998;
}

/* Dialog container - centered with flexbox */
.ai-instructions-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

/* Modal window - matches DocuShare popup style (800x572 to match sessions dialog) */
.ai-instructions-modal {
    position: relative;
    width: 800px;
    height: 572px;
    max-width: 90vw;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    border: 1px solid #d0d0d0;
}

/* Header - matches DocuShare dialog header */
.ai-instructions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 50px 14px 20px;
    min-height: 55px;
    border-bottom: 1px solid #edeff1;
    background: transparent;
    position: relative;
    box-sizing: border-box;
}

.ai-instructions-title {
    margin: 0;
    font-size: 21px;
    font-weight: normal;
    color: #383e42;
    font-family: Roboto, sans-serif;
}

.ai-instructions-close {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    font-size: 19px;
    color: #383e42;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.ai-instructions-close:hover {
    color: #000;
}

/* Body */
.ai-instructions-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background-color: #ebedef;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Toolbar */
.ai-instructions-toolbar {
    padding: 15px 20px;
    border-bottom: 1px solid #d0d0d0;
    background: #fff;
}

/* Content area */
.ai-instructions-content {
    padding: 15px 20px;
    min-height: 200px;
}

/* Loading state - matches DocuShare standard clock animation */
.ai-instructions-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    min-height: 200px;
    background-color: #edeff1;
}

.ai-instructions-loading .loading-clock {
    position: relative;
    border: 4px solid #9ba3a9;
    width: 74px;
    height: 74px;
    border-radius: 50%;
}

.ai-instructions-loading .loading-clock .arrow {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    margin: auto;
    background-color: #9ba3a9;
    transform-origin: center bottom;
}

.ai-instructions-loading .loading-clock .arrow--long {
    width: 4px;
    height: 30%;
    top: -30%;
    transform: rotate(60deg);
    animation: ai-clock-spin-long 3s infinite linear;
}

.ai-instructions-loading .loading-clock .arrow--short {
    width: 5px;
    height: 24%;
    top: -24%;
    transform: rotate(-60deg);
    animation: ai-clock-spin-short 60s infinite linear;
}

.ai-instructions-loading .loading-clock .clock-center {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    margin: auto;
    width: 5px;
    height: 5px;
    background-color: #9ba3a9;
    border-radius: 50%;
}

.ai-instructions-loading .loading-text {
    margin-top: 20px;
    color: #383e42;
    font-family: Roboto, sans-serif;
    font-size: 20px;
    font-weight: 400;
}

@keyframes ai-clock-spin-long {
    from { transform: rotate(60deg); }
    to { transform: rotate(420deg); }
}

@keyframes ai-clock-spin-short {
    from { transform: rotate(-60deg); }
    to { transform: rotate(300deg); }
}

/* Empty state */
.ai-instructions-empty {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* Instructions table - matches Save Sessions dialog */
.ai-instructions-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.ai-instructions-table thead {
    background: #f5f7f9;
    border-bottom: 1px solid #d0d0d0;
}

.ai-instructions-table th {
    padding: 10px 15px;
    text-align: left;
    font-weight: 500;
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
}

.ai-instructions-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #edeff1;
    vertical-align: middle;
}

.ai-instructions-table .name-col {
    width: 50%;
}

.ai-instructions-table .date-col {
    width: 25%;
    font-size: 13px;
    color: #666;
}

.ai-instructions-table .actions-col {
    width: 25%;
    text-align: right;
    white-space: nowrap;
}

.ai-instructions-row:hover {
    background: #f5f7f9;
}

.ai-instructions-item-name {
    font-weight: 500;
    color: #383e42;
}

.ai-instructions-item-status {
    display: inline-block;
    margin-left: 8px;
    vertical-align: middle;
}

.ai-instructions-item-status.invalid .icon-warning {
    color: #dc3545;
}

/* Play button and open-actions list - align with DocuShare table actions */
.ai-instructions-table .actions-col {
    font-size: 20px;
    color: #797c83;
}

.ai-instructions-table .actions-col ul.open-actions {
    margin: 0;
    padding: 0;
    list-style-type: none;
    display: inline-block;
    vertical-align: middle;
}

.ai-instructions-table .actions-col ul.open-actions li {
    display: inline-block;
    margin-right: 10px;
}

.ai-instructions-table .actions-col ul.open-actions li a {
    color: #6d7277;
    text-decoration: none;
    display: inline-block;
}

.ai-instructions-table .actions-col ul.open-actions li a:hover {
    color: #247ACB;
}

/* Play icon - custom SVG since not in DocuShare icon font */
.ai-instructions-table .icon-play {
    display: inline-block;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23383e42'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    vertical-align: middle;
}

.ai-instructions-table .actions-col ul.open-actions li a:hover .icon-play {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23247ACB'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
}

/* Dropdown menu - uses standard DocuShare .dropdown styles from docushare.css */
/* Override z-index for dialog context and reset text-align inherited from .actions-col */
.ai-instructions-table .dropdown ul.dropdown-items {
    z-index: 10000;
    text-align: left;
}

/* Warning icon for invalid instructions */
.icon-warning {
    display: inline-block;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23dc3545' d='M8 1L1 14h14L8 1zm0 3.5l4.5 8H3.5L8 4.5z'/%3E%3Cpath fill='%23dc3545' d='M7 6h2v4H7zM7 11h2v2H7z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    vertical-align: middle;
}

/* Buttons - matches DocuShare standard .submit pattern (docushare.css line 592) */
.ai-instructions-btn {
    display: inline-block;
    border: none;
    font-size: 15px;
    color: #FFF;
    min-width: 84px;
    height: 32px;
    line-height: 28px;
    text-align: center;
    cursor: pointer;
    border-radius: 3px;
    margin-right: 10px;
    outline: none;
    background: var(--ds-theme-primary, #383e42);
    font-family: Roboto, sans-serif;
    font-weight: 300;
    text-transform: uppercase;
    padding: 0 15px;
    text-decoration: none;
}

.ai-instructions-btn:not([disabled]):hover {
    background: #DCEEFE; /* fallback for old browsers */
    background: color-mix(in srgb, var(--ds-theme-primary, #247ACB) 12%, #ffffff);
    color: #2D3135;
}

.ai-instructions-btn:disabled {
    background: #edeff1;
    color: #9b9b9b;
    border: 2px solid #edeff1;
}

/* Primary = standard .submit, themed */
.ai-instructions-btn-primary {
    background: var(--ds-theme-primary, #383e42);
    color: #FFF;
}

/* Secondary/Cancel = standard .submit_white (white with border) */
.ai-instructions-btn-secondary {
    color: #2e3236;
    background: #fff;
    border: 1px solid #e3e6e9;
}

.ai-instructions-btn-secondary:not([disabled]):hover {
    background: #FFF;
    border: 1px solid #2e3236;
}

/* Success/Use = green action button */
.ai-instructions-btn-success {
    background: #2e7d32;
    color: #FFF;
}

.ai-instructions-btn-success:not([disabled]):hover {
    background: #1b5e20;
    color: #FFF;
}

/* Search bar */
.ai-instructions-search {
    padding: 8px 16px;
}

.ai-instructions-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e3e6e9;
    border-radius: 4px;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    box-sizing: border-box;
}

.ai-instructions-search-input:focus {
    outline: none;
    border-color: #0066cc;
}

/* Form elements */
.ai-instructions-form {
    padding: 20px;
    background: #fff;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.ai-instructions-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #383e42;
    font-size: 13px;
    flex-shrink: 0;
}

.ai-instructions-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    margin-bottom: 15px;
    box-sizing: border-box;
    font-family: inherit;
}

.ai-instructions-input:focus {
    outline: none;
    border-color: #0073cf;
    box-shadow: 0 0 0 2px rgba(0, 115, 207, 0.2);
}

.ai-instructions-textarea {
    width: 100%;
    flex: 1;
    min-height: 150px;
    padding: 12px;
    font-size: 14px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    margin-bottom: 10px;
    box-sizing: border-box;
    font-family: 'Courier New', monospace;
    resize: none;
    line-height: 1.5;
}

.ai-instructions-textarea:focus {
    outline: none;
    border-color: #0073cf;
    box-shadow: 0 0 0 2px rgba(0, 115, 207, 0.2);
}

/* Stats display */
.ai-instructions-stats {
    font-size: 12px;
    color: #666;
    margin-bottom: 15px;
}

/* Actions bar at bottom of form views */
.ai-instructions-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    background: #fff;
    border-top: 1px solid #edeff1;
}

/* View containers */
.ai-instructions-view {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.ai-instructions-view.active {
    display: flex;
}

/* Toast notifications */
.ai-instructions-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    z-index: 10001;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    animation: toast-slide-in 0.3s ease;
}

.ai-instructions-toast.success {
    background: #28a745;
}

.ai-instructions-toast.error {
    background: #dc3545;
}

.ai-instructions-toast.warning {
    background: #ffc107;
    color: #333;
}

@keyframes toast-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* --- END AI-GENERATED CODE --- */
