/**
 * Agent R Mobile Messaging Styles
 * Optimized for mobile text messaging environments
 */

/* Popup Container */
.agent-r-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.agent-r-popup.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Overlay */
.agent-r-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

/* Popup Content */
.agent-r-popup-content {
    position: relative;
    width: 95%;
    max-width: 500px;
    max-height: 90vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: slideUp 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    flex-direction: column;
}

/* Header */
.agent-r-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
    border-bottom: 2px solid #00d9ff;
}

.agent-r-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.agent-r-icon {
    font-size: 32px;
    animation: float 3s ease-in-out infinite;
}

.agent-r-header h2 {
    color: #00d9ff;
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 0 10px rgba(0, 217, 255, 0.5);
}

.agent-r-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 32px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}

.agent-r-close:hover {
    background: rgba(255, 77, 77, 0.3);
    transform: rotate(90deg);
}

/* Security Status */
.agent-r-security-status {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(0, 217, 255, 0.2);
}

.security-check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    color: #fff;
    font-size: 14px;
    transition: all 0.3s;
}

.security-check .security-icon {
    font-size: 20px;
}

.security-check.verified {
    color: #00ff88;
}

.security-check.failed {
    color: #ff4d4d;
}

/* Forms Container */
.agent-r-forms-container {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.agent-r-forms-container h3 {
    color: #00d9ff;
    font-size: 18px;
    margin: 0 0 15px 0;
    font-weight: 600;
}

.agent-r-forms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

/* Form Cards */
.agent-r-form-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(0, 217, 255, 0.2);
    border-radius: 12px;
    padding: 20px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.agent-r-form-card:hover,
.agent-r-form-card:active {
    background: rgba(0, 217, 255, 0.1);
    border-color: #00d9ff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 217, 255, 0.3);
}

.agent-r-form-card .form-icon {
    font-size: 36px;
    margin-bottom: 5px;
}

.agent-r-form-card .form-name {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
}

/* AI Deployment Section */
.agent-r-ai-deployment {
    padding: 15px 20px;
    background: rgba(0, 217, 255, 0.05);
    border-top: 1px solid rgba(0, 217, 255, 0.2);
}

.agent-r-ai-deployment h3 {
    color: #00d9ff;
    font-size: 16px;
    margin: 0 0 12px 0;
}

.deployment-status {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.deployment-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #00ff88;
    font-size: 14px;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    background: #00ff88;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.deploy-btn {
    background: linear-gradient(135deg, #00d9ff 0%, #0088ff 100%);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.deploy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 217, 255, 0.5);
}

/* Form Detail Section */
.agent-r-form-detail {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.back-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #00d9ff;
    border: 1px solid rgba(0, 217, 255, 0.3);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 15px;
    transition: all 0.3s;
}

.back-btn:hover {
    background: rgba(0, 217, 255, 0.1);
    border-color: #00d9ff;
}

#form-content h3 {
    color: #00d9ff;
    font-size: 20px;
    margin: 0 0 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Form Styles */
.agent-r-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.agent-r-form label {
    color: #00d9ff;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 5px;
    display: block;
}

.agent-r-form input[type="text"],
.agent-r-form textarea,
.agent-r-form select,
.deployment-select {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s;
}

/* Consolidated form input styles */
.agent-r-form input[type="text"]:focus,
.agent-r-form textarea:focus,
.agent-r-form select:focus,
.deployment-select:focus {
    outline: none;
    border-color: #00d9ff;
    background: rgba(0, 217, 255, 0.05);
    box-shadow: 0 0 10px rgba(0, 217, 255, 0.2);
}

.agent-r-form textarea {
    resize: vertical;
    min-height: 80px;
}

.submit-btn {
    background: linear-gradient(135deg, #00ff88 0%, #00d9ff 100%);
    color: #000;
    border: none;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 255, 136, 0.5);
}

/* Security Report */
.security-report {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.security-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 255, 136, 0.05);
    border-left: 3px solid #00ff88;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
}

.security-item .status-icon {
    font-size: 20px;
}

/* Deployment Form */
.deployment-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.deployment-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.deployment-options label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.deployment-options input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Status Dashboard */
.status-dashboard {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.status-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
}

.status-label {
    color: #00d9ff;
    font-size: 12px;
    margin-bottom: 8px;
    font-weight: 500;
}

.status-value {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
}

.status-value.active {
    color: #00ff88;
}

/* Command Interface */
.command-interface {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.command-history {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: 8px;
    padding: 15px;
    min-height: 200px;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.command-entry {
    margin-bottom: 10px;
}

.command-input-line {
    color: #00d9ff;
    margin-bottom: 5px;
}

.command-output {
    color: #00ff88;
    padding-left: 15px;
}

.command-input-container {
    display: flex;
    gap: 10px;
}

.command-input {
    flex: 1;
    padding: 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: 8px;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.execute-btn {
    background: linear-gradient(135deg, #00d9ff 0%, #0088ff 100%);
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.execute-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 217, 255, 0.4);
}

.command-suggestions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cmd-suggest {
    background: rgba(0, 217, 255, 0.1);
    border: 1px solid rgba(0, 217, 255, 0.3);
    color: #00d9ff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: all 0.3s;
}

.cmd-suggest:hover {
    background: rgba(0, 217, 255, 0.2);
    border-color: #00d9ff;
}

/* Format Options */
.format-options {
    display: flex;
    gap: 20px;
    padding: 10px;
}

.format-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.format-options input[type="radio"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Success Toast */
.agent-r-success-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, #00ff88 0%, #00d9ff 100%);
    color: #000;
    padding: 15px 30px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 10px 30px rgba(0, 255, 136, 0.4);
    z-index: 1000000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.agent-r-success-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

/* Mobile Optimizations */
@media (max-width: 480px) {
    .agent-r-popup-content {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .agent-r-header {
        padding: 15px;
    }

    .agent-r-header h2 {
        font-size: 20px;
    }

    .agent-r-icon {
        font-size: 28px;
    }

    .agent-r-forms-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .agent-r-form-card {
        padding: 15px 10px;
        min-height: 90px;
    }

    .agent-r-form-card .form-icon {
        font-size: 30px;
    }

    .agent-r-form-card .form-name {
        font-size: 12px;
    }

    .status-dashboard {
        grid-template-columns: 1fr;
    }

    .command-suggestions {
        flex-direction: column;
    }

    .cmd-suggest {
        text-align: center;
    }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .agent-r-popup-content {
        max-height: 100vh;
    }

    .agent-r-header {
        padding: 10px 15px;
    }

    .agent-r-forms-container,
    .agent-r-form-detail {
        padding: 15px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: light) {
    .agent-r-popup-content {
        background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    }

    .agent-r-header {
        background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .agent-r-form-card {
        border-width: 3px;
    }

    .agent-r-popup-content {
        border: 2px solid #00d9ff;
    }
}
