/* 
 * AI Document Assistant - Taskpane Styles
 * IE11 Compatible (no gap, uses -ms- prefixes, margins instead of gap)
 */

/* ========== Base Reset ========== */
html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #faf9f8;
    color: #323130;
}

*,
*::before,
*::after {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

/* ========== Header ========== */
.app-header {
    background-color: #0078d4;
    color: #ffffff;
    padding: 16px 16px 14px;
    margin: 0;
}

.app-title {
    margin: 0 0 4px 0;
    font-weight: 600;
    color: #ffffff;
}

.app-subtitle {
    margin: 0;
    color: rgba(255, 255, 255, 0.85);
}

/* ========== Main Content ========== */
.app-main {
    padding: 0 16px 16px;
}

/* ========== Sections ========== */
.app-section {
    margin-top: 16px;
}

.app-section:first-child {
    margin-top: 16px;
}

/* ========== Instructions Section ========== */
.section-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #323130;
}

.label-optional {
    font-weight: 400;
    color: #605e5c;
}

.instructions-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #8a8886;
    border-radius: 2px;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
}

.instructions-input:focus {
    border-color: #0078d4;
    outline: none;
}

.instructions-input::-webkit-input-placeholder {
    color: #a19f9d;
}

.instructions-input:-ms-input-placeholder {
    color: #a19f9d;
}

.instructions-input::placeholder {
    color: #a19f9d;
}

/* ========== Step Sections ========== */
.step-section {
    background-color: #ffffff;
    border: 1px solid #edebe9;
    border-radius: 4px;
    padding: 14px;
}

.step-header {
    margin-bottom: 12px;
}

.step-number {
    display: inline-block;
    background-color: #0078d4;
    color: #ffffff;
    padding: 2px 8px;
    border-radius: 2px;
    font-weight: 600;
    margin-right: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.step-title {
    font-weight: 600;
    color: #323130;
}

/* ========== Buttons ========== */
.action-btn {
    display: -ms-inline-flexbox;
    display: inline-flex;
    -ms-flex-align: center;
    align-items: center;
    -ms-flex-pack: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    font-weight: 600;
    min-width: 120px;
    -webkit-transition: background-color 0.1s ease;
    -o-transition: background-color 0.1s ease;
    transition: background-color 0.1s ease;
}

.primary-btn {
    background-color: #0078d4;
    color: #ffffff;
}

.primary-btn:hover:not(:disabled) {
    background-color: #106ebe;
}

.primary-btn:active:not(:disabled) {
    background-color: #005a9e;
}

.primary-btn:disabled {
    background-color: #c8c6c4;
    color: #a19f9d;
    cursor: not-allowed;
}

.control-btn {
    display: inline-block;
    padding: 6px 12px;
    background-color: #ffffff;
    border: 1px solid #8a8886;
    border-radius: 2px;
    color: #323130;
    cursor: pointer;
    font-weight: 400;
    -webkit-transition: background-color 0.1s ease;
    -o-transition: background-color 0.1s ease;
    transition: background-color 0.1s ease;
}

.control-btn:hover {
    background-color: #f3f2f1;
}

.control-btn:active {
    background-color: #edebe9;
}

/* Button with spinner - IE11 compatible flexbox */
.btn-text {
    display: inline-block;
}

.btn-spinner {
    display: -ms-inline-flexbox;
    display: inline-flex;
    -ms-flex-align: center;
    align-items: center;
    margin-left: 8px;
}

/* Spinner animation */
@-webkit-keyframes spin {
    0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); }
    100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
}

@keyframes spin {
    0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); }
    100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
}

.spinner-icon {
    -webkit-animation: spin 1s linear infinite;
    animation: spin 1s linear infinite;
    font-size: 14px;
}

/* ========== Status Messages ========== */
.status-message {
    margin-top: 10px;
    padding: 0;
    color: #605e5c;
    min-height: 18px;
}

.status-message.error {
    color: #a4262c;
}

.status-message.success {
    color: #107c10;
}

/* ========== Apply Note ========== */
.apply-note {
    margin: 10px 0 0;
    color: #605e5c;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-align: center;
    align-items: center;
}

.apply-note .ms-Icon {
    margin-right: 6px;
    font-size: 12px;
}

/* ========== Plan Results Section ========== */
.plan-header {
    margin-bottom: 12px;
}

.plan-title {
    font-weight: 600;
    color: #323130;
}

.plan-count {
    color: #605e5c;
    margin-left: 4px;
}

/* ========== Plan List ========== */
.plan-list {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
    flex-direction: column;
}

.plan-list-empty {
    padding: 16px;
    text-align: center;
    color: #605e5c;
    background-color: #f3f2f1;
    border-radius: 4px;
}

/* ========== Plan Items ========== */
.plan-item {
    background-color: #ffffff;
    border: 1px solid #edebe9;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 10px;
    -webkit-transition: border-color 0.1s ease;
    -o-transition: border-color 0.1s ease;
    transition: border-color 0.1s ease;
}

.plan-item:last-child {
    margin-bottom: 0;
}

.plan-item.selected {
    border-color: #0078d4;
    background-color: #f0f6fc;
}

.plan-item-header {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-align: start;
    align-items: flex-start;
}

.plan-checkbox {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-align: center;
    align-items: center;
    cursor: pointer;
    width: 100%;
}

.plan-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    margin-right: 10px;
    cursor: pointer;
    -ms-flex-negative: 0;
    flex-shrink: 0;
}

.plan-item-title {
    font-weight: 600;
    color: #323130;
    line-height: 1.3;
}

.plan-item-description {
    margin: 8px 0 0 28px;
    color: #605e5c;
    line-height: 1.4;
}

/* ========== Plan Controls ========== */
.plan-controls {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #edebe9;
}

.plan-controls .control-btn {
    margin-right: 8px;
}

.plan-controls .control-btn:last-child {
    margin-right: 0;
}

/* ========== Confirmation Dialog ========== */
.confirm-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    display: -ms-flexbox;
    display: flex;
    -ms-flex-align: center;
    align-items: center;
    -ms-flex-pack: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.confirm-content {
    background-color: #ffffff;
    border-radius: 4px;
    padding: 20px;
    max-width: 300px;
    width: 100%;
    -webkit-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.confirm-message {
    margin: 0 0 16px;
    color: #323130;
    line-height: 1.4;
}

.confirm-buttons {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-pack: end;
    justify-content: flex-end;
}

.confirm-buttons .control-btn {
    margin-right: 8px;
}

.confirm-buttons .control-btn:last-child {
    margin-right: 0;
}

.confirm-buttons .action-btn {
    margin-left: 0;
}

/* ========== Result Message ========== */
.result-message {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    display: -ms-flexbox;
    display: flex;
    -ms-flex-align: center;
    align-items: center;
    -ms-flex-pack: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.result-content {
    background-color: #ffffff;
    border-radius: 4px;
    padding: 24px;
    max-width: 280px;
    width: 100%;
    text-align: center;
    -webkit-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.result-content .ms-Icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.result-content .ms-Icon.success {
    color: #107c10;
}

.result-content .ms-Icon.error {
    color: #a4262c;
}

#result-text {
    margin: 0 0 16px;
    color: #323130;
    line-height: 1.4;
}

/* ========== Loading state for entire section ========== */
.is-loading {
    opacity: 0.7;
    pointer-events: none;
}

/* ========== Progress indicator ========== */
.progress-text {
    font-style: italic;
}
