/* municipal-ai-reporter/assets/css/style.css */

#mar-chat-interface {
    max-width: 1000px;
    margin: 20px auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#mar-chat-header {
    background-color: #f5f5f5;
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
}

#mar-chat-header h3 {
    margin: 0;
    font-size: 1.1em;
    color: #333;
}

/* User Info Section */
#mar-user-info-section {
    padding: 20px;
    background-color: #f9f9f9;
    border-bottom: 1px solid #e0e0e0;
}

.mar-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.mar-form-row-single {
    grid-template-columns: 1fr;
}

.mar-form-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.mar-form-field label {
    font-size: 0.9em;
    font-weight: 600;
    color: #333;
}

.mar-required {
    color: #d32f2f;
}

.mar-form-field input {
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.95em;
    outline: none;
    transition: border-color 0.2s;
}

.mar-form-field input:focus {
    border-color: #0569B4;
    box-shadow: 0 0 0 2px rgba(5, 105, 180, 0.1);
}

.mar-error {
    font-size: 0.8em;
    color: #d32f2f;
    min-height: 18px;
}

.mar-checkbox-field {
    margin-bottom: 15px;
}

.mar-checkbox-field label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #333;
    font-weight: 600;
}

.mar-checkbox-field input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.mar-info-message {
    padding: 12px 15px;
    background-color: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 6px;
    font-size: 0.9em;
    color: #1976d2;
    text-align: center;
}

.mar-success-message {
    padding: 12px 15px;
    background-color: #e8f5e9;
    border: 1px solid #81c784;
    border-radius: 6px;
    font-size: 0.9em;
    color: #2e7d32;
    text-align: center;
}

#mar-image-upload-section {
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    background-color: #fcfcfc;
}

.mar-upload-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

.mar-file-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.82em;
    color: #666;
    font-weight: 400;
}

.mar-upload-btn {
    border: 1px solid #0569B4;
    background-color: #fff;
    color: #0569B4;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.mar-upload-btn:hover {
    background-color: #f1f7fc;
}

#mar-image-preview {
    margin-top: 10px;
}

.mar-image-preview-card {
    display: inline-flex;
    flex-direction: column;
    gap: 8px;
    max-width: 220px;
}

.mar-image-preview-card img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.mar-remove-image-btn {
    border: none;
    background: #d32f2f;
    color: #fff;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.85em;
}

.mar-upload-info,
.mar-upload-error {
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.88em;
}

.mar-upload-info {
    background-color: #e8f5e9;
    border: 1px solid #81c784;
    color: #2e7d32;
}

.mar-upload-error {
    background-color: #ffebee;
    border: 1px solid #ef9a9a;
    color: #c62828;
}


#mar-chat-history {
    height: 400px;
    overflow-y: auto;
    padding: 20px;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mar-message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    line-height: 1.4;
    font-size: 0.95em;
    position: relative;
    word-wrap: break-word;
}

.mar-message.mar-ai {
    background-color: #f0f0f0;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.mar-message.mar-user {
    background-color: #0569B4;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

#mar-chat-input-area {
    padding: 15px;
    background-color: #f9f9f9;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
}

#mar-user-input {
    flex-grow: 1;
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 25px;
    outline: none;
    font-size: 1em;
}

#mar-user-input:focus {
    border-color: #0569B4;
}

#mar-send-btn {
    background-color: #0569B4;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

#mar-send-btn:hover {
    background-color: #045291;
}

#mar-send-btn:disabled {
    background-color: #a0a0a0;
    cursor: not-allowed;
}

/* Loading Indicator */
.mar-loading {
    align-self: flex-start;
    background-color: #f0f0f0;
    padding: 10px 15px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 50px;
    height: 40px;
    /* match approximate height of single line text */
}

.mar-dot {
    width: 8px;
    height: 8px;
    background-color: #999;
    border-radius: 50%;
    animation: mar-bounce 1.4s infinite ease-in-out both;
}

.mar-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.mar-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes mar-bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Two-column layout for desktop */
#mar-chat-main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 500px;
}

#mar-left-column {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e0e0e0;
}

#mar-right-column {
    display: flex;
    flex-direction: column;
}

#mar-left-column #mar-user-info-section {
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

#mar-left-column #mar-image-upload-section {
    border-bottom: none;
    flex-shrink: 0;
}

#mar-right-column #mar-chat-history {
    flex: 1;
    height: auto;
    min-height: 400px;
}

#mar-right-column #mar-chat-input-area {
    border-top: 1px solid #e0e0e0;
}

@media (max-width: 768px) {
    #mar-chat-interface {
        margin: 0;
        border-radius: 0;
        height: 100vh;
        /* Full screen on mobile */
        border: none;
    }

    #mar-chat-main-content {
        display: flex;
        flex-direction: column;
        min-height: auto;
    }

    #mar-left-column {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .mar-form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    #mar-right-column #mar-chat-history {
        flex-grow: 1;
        height: auto;
        min-height: 200px;
    }
}
