/* Main styles for Brutus Word Add-in */

/* Base styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #faf9f8;
    color: #323130;
    line-height: 1.4;
    font-size: 14px;
}

.ms-welcome {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.ms-welcome__header {
    background-color: #0078d4;
    background: linear-gradient(135deg, #0078d4 0%, #106ebe 100%);
    color: white;
    padding: 20px;
    text-align: center;
    border-bottom: 2px solid #005a9e;
}

.ms-welcome__header img {
    margin-bottom: 10px;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.ms-welcome__header h1 {
    margin: 10px 0 5px;
    font-size: 24px;
    font-weight: 300;
}

/* Main content */
.ms-welcome__main {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* Grid system */
.ms-Grid {
    display: block;
    width: 100%;
}

.ms-Grid-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.ms-Grid-col {
    padding: 0 10px;
    flex: 1;
}

.ms-Grid-col.ms-sm12 {
    width: 100%;
}

/* Typography */
.ms-font-su {
    font-size: 28px;
    font-weight: 100;
    margin: 0;
}

.ms-font-l {
    font-size: 20px;
    font-weight: 300;
    margin: 0 0 15px;
    color: #323130;
}

.ms-font-m {
    font-size: 14px;
    margin: 0 0 10px;
    color: #605e5c;
}

/* Form controls */
.ms-TextField {
    margin-bottom: 20px;
}

.ms-Label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #323130;
    margin-bottom: 5px;
}

.ms-TextField-field {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d2d0ce;
    border-radius: 2px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.ms-TextField-field:focus {
    outline: none;
    border-color: #0078d4;
    box-shadow: 0 0 0 1px #0078d4;
}

.ms-TextField-field::placeholder {
    color: #a19f9d;
}

textarea.ms-TextField-field {
    resize: vertical;
    min-height: 80px;
}

/* Buttons */
.action-buttons {
    margin: 20px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ms-Button {
    border: none;
    border-radius: 2px;
    cursor: pointer;
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 16px;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
    min-width: 120px;
    position: relative;
}

.ms-Button:focus {
    outline: none;
    box-shadow: 0 0 0 1px #0078d4;
}

.ms-Button--primary {
    background-color: #0078d4;
    color: white;
}

.ms-Button--primary:hover {
    background-color: #106ebe;
}

.ms-Button--primary:active {
    background-color: #005a9e;
}

.ms-Button--secondary {
    background-color: #f3f2f1;
    color: #323130;
    border: 1px solid #d2d0ce;
}

.ms-Button--secondary:hover {
    background-color: #edebe9;
    border-color: #c8c6c4;
}

.ms-Button--secondary:active {
    background-color: #e1dfdd;
}

.ms-Button-label {
    display: block;
}

/* Results section */
.results-container {
    background: white;
    border: 1px solid #d2d0ce;
    border-radius: 4px;
    padding: 20px;
    margin: 15px 0;
    max-height: 300px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
}

.results-container p {
    margin: 0 0 10px;
}

.results-container strong {
    font-weight: 600;
    color: #323130;
}

.results-container em {
    font-style: italic;
    color: #605e5c;
}

/* Loading indicator */
.ms-Spinner {
    text-align: center;
    padding: 20px;
}

.ms-Spinner--large .ms-Spinner-circle {
    width: 28px;
    height: 28px;
    border: 2px solid #f3f2f1;
    border-top: 2px solid #0078d4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

.ms-Spinner-label {
    font-size: 14px;
    color: #605e5c;
}

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

/* Message bars */
.ms-MessageBar {
    padding: 12px 16px;
    margin: 10px 0;
    border-radius: 2px;
    display: flex;
    align-items: flex-start;
    border-left: 4px solid;
}

.ms-MessageBar--info {
    background-color: #deecf9;
    border-left-color: #0078d4;
    color: #323130;
}

.ms-MessageBar--success {
    background-color: #dff6dd;
    border-left-color: #107c10;
    color: #323130;
}

.ms-MessageBar--warning {
    background-color: #fff4ce;
    border-left-color: #ffb900;
    color: #323130;
}

.ms-MessageBar--error {
    background-color: #fde7e9;
    border-left-color: #d13438;
    color: #323130;
}

.ms-MessageBar-content {
    display: flex;
    align-items: flex-start;
    width: 100%;
}

.ms-MessageBar-icon {
    margin-right: 8px;
    margin-top: 2px;
}

.ms-MessageBar-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
}

/* Icons (basic implementation) */
.ms-Icon::before {
    font-family: 'Fabric MDL2 Assets', sans-serif;
    font-size: 16px;
}

.ms-Icon--Info::before { content: '\E946'; }
.ms-Icon--CheckMark::before { content: '\E73E'; }
.ms-Icon--Warning::before { content: '\E7BA'; }
.ms-Icon--ErrorBadge::before { content: '\E783'; }

/* Utility classes */
.ms-textAlignCenter {
    text-align: center;
}

.ms-bgColor-neutralLighter {
    background-color: #f8f8f8;
}

/* Responsive design */
@media (max-width: 480px) {
    .ms-welcome__main {
        padding: 15px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .ms-Button {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .ms-Grid-row {
        margin: 0;
    }
    
    .ms-Grid-col {
        padding: 0;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1e1e1e;
        color: #ffffff;
    }
    
    .ms-welcome__main {
        background-color: #1e1e1e;
    }
    
    .results-container {
        background-color: #2d2d30;
        border-color: #3e3e42;
        color: #ffffff;
    }
    
    .ms-TextField-field {
        background-color: #2d2d30;
        border-color: #3e3e42;
        color: #ffffff;
    }
    
    .ms-TextField-field:focus {
        border-color: #0078d4;
    }
    
    .ms-Label {
        color: #ffffff;
    }
    
    .ms-Button--secondary {
        background-color: #2d2d30;
        color: #ffffff;
        border-color: #3e3e42;
    }
    
    .ms-Button--secondary:hover {
        background-color: #3e3e42;
    }
}

/* ================================
   WebMCP Styles
   ================================ */

/* Connection status bar */
.webmcp-status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: #f3f2f1;
    border: 1px solid #d2d0ce;
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 13px;
}

.webmcp-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background-color: #a19f9d;
}

.webmcp-indicator--connected {
    background-color: #107c10;
    box-shadow: 0 0 4px rgba(16, 124, 16, 0.4);
}

.webmcp-indicator--connecting {
    background-color: #ffb900;
    animation: pulse 1.5s ease-in-out infinite;
}

.webmcp-indicator--detected {
    background-color: #0078d4;
}

.webmcp-indicator--disconnected {
    background-color: #a19f9d;
}

.webmcp-indicator--error {
    background-color: #d13438;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.webmcp-status-text {
    flex: 1;
    color: #605e5c;
    font-size: 12px;
}

.webmcp-btn {
    padding: 4px 12px;
    font-size: 12px;
    min-width: auto;
}

/* WebMCP Options */
.webmcp-options {
    padding: 8px 12px;
    margin-bottom: 12px;
    background-color: #f8f8f8;
    border: 1px solid #e1dfdd;
    border-radius: 4px;
}

.webmcp-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #605e5c;
    cursor: pointer;
}

.webmcp-checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

/* Edit confirmation modal */
.webmcp-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.webmcp-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
}

.webmcp-modal-content {
    position: relative;
    background: white;
    border-radius: 4px;
    padding: 20px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 10001;
}

.webmcp-modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #323130;
    margin: 0 0 12px;
}

.webmcp-modal-action {
    font-size: 14px;
    color: #605e5c;
    margin: 0 0 12px;
}

.webmcp-modal-preview {
    background-color: #f3f2f1;
    border: 1px solid #d2d0ce;
    border-radius: 2px;
    padding: 12px;
    margin-bottom: 16px;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
    color: #323130;
    white-space: pre-wrap;
    word-break: break-word;
}

.webmcp-modal-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Edit log */
.webmcp-edit-log {
    margin-top: 16px;
    padding: 12px;
    background-color: #f8f8f8;
    border: 1px solid #e1dfdd;
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.webmcp-edit-log h4 {
    font-size: 13px;
    font-weight: 600;
    color: #323130;
    margin: 0 0 8px;
}

.webmcp-log-entry {
    font-size: 11px;
    padding: 4px 0;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.webmcp-log-entry:last-child {
    border-bottom: none;
}

.webmcp-log-entry--success {
    color: #323130;
}

.webmcp-log-entry--error {
    color: #d13438;
}

.webmcp-log-time {
    color: #a19f9d;
    flex-shrink: 0;
    font-family: 'Consolas', monospace;
}

.webmcp-log-action {
    color: #0078d4;
    font-weight: 600;
    flex-shrink: 0;
}

.webmcp-log-detail {
    color: #605e5c;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Dark mode support for WebMCP elements */
@media (prefers-color-scheme: dark) {
    .webmcp-status-bar {
        background-color: #2d2d30;
        border-color: #3e3e42;
    }
    
    .webmcp-status-text {
        color: #d4d4d4;
    }
    
    .webmcp-options {
        background-color: #2d2d30;
        border-color: #3e3e42;
    }
    
    .webmcp-checkbox-label {
        color: #d4d4d4;
    }
    
    .webmcp-modal-content {
        background-color: #1e1e1e;
    }
    
    .webmcp-modal-title {
        color: #ffffff;
    }
    
    .webmcp-modal-action {
        color: #d4d4d4;
    }
    
    .webmcp-modal-preview {
        background-color: #2d2d30;
        border-color: #3e3e42;
        color: #d4d4d4;
    }
    
    .webmcp-edit-log {
        background-color: #2d2d30;
        border-color: #3e3e42;
    }
    
    .webmcp-edit-log h4 {
        color: #ffffff;
    }
    
    .webmcp-log-entry--success {
        color: #d4d4d4;
    }
}

/* Print styles */
@media print {
    .ms-welcome__header,
    .action-buttons,
    .ms-MessageBar,
    .webmcp-status-bar,
    .webmcp-options,
    .webmcp-edit-log,
    .webmcp-modal {
        display: none;
    }
    
    .results-container {
        border: none;
        box-shadow: none;
        max-height: none;
        overflow: visible;
    }
}