/* CSS Master Drilling - Light Theme */
:root {
    --bg-color: #f4f6f9;
    --panel-bg: #ffffff;
    --panel-border: #e2e8f0;
    
    --text-main: #1f2937;
    --text-muted: #64748b;
    
    /* Master Drilling Colors based on logo styling */
    --accent: #2c3e50; /* Dark blue from 'M' */
    --accent-hover: #1a252f;
    --brand-blue: #3b5998;
    
    --input-bg: #f8fafc;
    --input-border: #cbd5e1;
    --input-focus: #e2e8f0;
    
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.05);

    /* Status Colors */
    --success: #0f766e;
    --success-bg: #ccfbf1;
    --warning: #b45309;
    --warning-bg: #fef3c7;
    --error: #b91c1c;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 30px 15px;
}

/* Main Container */
.container {
    width: 100%;
    max-width: 800px;
}

/* Form Wrapper */
.form-wrapper {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
}

/* Header Styles */
.form-header {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--panel-border);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.logo-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    border: 1px solid #f1f1f1;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-logo {
    width: 70px; /* Reduced as requested */
    height: auto;
    display: block;
}

.header-text {
    flex: 1;
}

.brand-subtitle {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.brand-title {
    font-weight: 700;
    font-size: 26px;
    color: var(--text-main);
}

.header-description {
    font-size: 16px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 20px;
}

/* Status Badges Row */
.status-bars {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.status-badge, .sync-status {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
}

.status-badge.online {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(15, 118, 110, 0.2);
}

.status-badge.offline {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(180, 83, 9, 0.2);
}

.sync-status {
    background: #f1f5f9;
    color: var(--text-muted);
    border: 1px solid #cbd5e1;
}

/* Form Sections (Blocks) */
.form-section {
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 24px 20px;
    margin-bottom: 24px;
    background: #fafcff;
}

.form-section legend {
    font-size: 14px;
    font-weight: 700;
    color: var(--brand-blue);
    padding: 4px 16px;
    background: white;
    border-radius: 20px;
    border: 1px solid var(--brand-blue);
    margin-left: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.full-width {
    grid-column: 1 / -1;
}

/* Numbered Steps */
.numbered-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.numbered-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.number-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--brand-blue);
    color: white;
    font-weight: 700;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
    font-size: 14px;
}

.hidden {
    display: none !important;
}

.input-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.input-group input[type="text"],
.input-group input[type="number"],
.input-group input[type="date"],
.input-group input[type="time"],
.input-group textarea {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-main);
    font-size: 15px;
    outline: none;
    transition: all 0.2s ease;
}

.input-group textarea {
    resize: vertical;
    min-height: 100px;
}

.input-group input:focus,
.input-group textarea:focus {
    border-color: var(--brand-blue);
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 89, 152, 0.1);
}

.input-group input::placeholder,
.input-group textarea::placeholder {
    color: #94a3b8;
}

/* Radio Pills UX */
.radio-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.radio-pills label.pill {
    flex: 1;
    min-width: 100px; /* enough space for tapping */
    text-align: center;
    cursor: pointer;
    display: flex; /* Permite que o span preencha o tamanho total */
}

.radio-pills.multi-line label.pill {
    flex: 1 1 calc(25% - 10px); /* 4 colunas no Desktop */
}

.radio-pills input[type="radio"] {
    /* Accessibility fix for mobile validation tooltips (Firefox/Safari) */
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    pointer-events: none;
}

.radio-pills span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 10px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    user-select: none;
}

.radio-pills input[type="radio"]:checked + span {
    background: var(--brand-blue);
    border-color: var(--brand-blue);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(59, 89, 152, 0.3);
}

/* Standard Radio Buttons (for Yes/No) */
.radio-group {
    display: flex;
    gap: 16px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    flex: 1;
    transition: all 0.2s ease;
}

.radio-group label:focus-within {
    border-color: var(--brand-blue);
    background: rgba(59, 89, 152, 0.05);
}

.radio-group input[type="radio"] {
    appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid var(--text-muted);
    border-radius: 50%;
    background: white;
    display: inline-block;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-group input[type="radio"]:checked {
    border-color: var(--brand-blue);
}

.radio-group input[type="radio"]:checked::after {
    content: '';
    width: 12px;
    height: 12px;
    background: var(--brand-blue);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Conditional Field Animation */
.conditional-field {
    animation: fadeIn 0.3s ease-in-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Form Actions Button */
.form-actions {
    margin-top: 35px;
}

.btn-primary {
    width: 100%;
    background: var(--brand-blue);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.btn-primary:hover {
    background: #2a4175;
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-primary:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

/* Loader */
.spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
    position: absolute;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast Notification */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
    width: 90%;
    max-width: 400px;
}

.toast {
    background: var(--text-main);
    color: white;
    padding: 16px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.toast.success { border-left: 5px solid #10b981; }
.toast.warning { border-left: 5px solid #f59e0b; }
.toast.error { border-left: 5px solid #ef4444; }

.toast.fade-out {
    animation: fadeOut 0.4s ease forwards;
}

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

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

/* Mobile Adjustments */
@media (max-width: 768px) {
    body {
        padding: 0;
        background: var(--panel-bg);
    }
    
    .form-wrapper {
        border-radius: 0;
        border: none;
        box-shadow: none;
        padding: 20px 15px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .radio-pills.multi-line label.pill {
        flex: 1 1 calc(50% - 10px);
    }

    .header-content {
        flex-direction: row;
        gap: 15px;
    }
    
    .brand-title {
        font-size: 20px;
    }
    
    .brand-logo {
        width: 55px;
    }
}

/* Checkbox specific styles */
.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.custom-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    font-size: 15px;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-checkbox:hover {
    background: rgba(59, 89, 152, 0.05);
}

.custom-checkbox input[type="checkbox"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-muted);
    border-radius: 4px;
    background: white;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}

.custom-checkbox input[type="checkbox"]:checked {
    background: var(--brand-blue);
    border-color: var(--brand-blue);
}

.custom-checkbox input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 14px;
    font-weight: bold;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* --- Context Card Premium --- */
.context-card {
    background: linear-gradient(145deg, #ffffff, #fafafa);
    border-left: 4px solid var(--brand-blue);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255,255,255,0.8);
    margin: 0 20px 24px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.context-card.hidden {
    display: none;
}

.context-card-header {
    background: rgba(59, 89, 152, 0.05);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

.context-card-header h3 {
    margin: 0;
    font-size: 15px;
    color: var(--brand-blue);
    font-weight: 700;
}

.context-card-body {
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.context-info {
    display: flex;
    flex-direction: column;
}

.context-info.full-width {
    grid-column: 1 / -1;
}

.context-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.context-value {
    font-size: 14px;
    color: var(--text-main);
    font-weight: 600;
}

.context-text {
    font-size: 14px;
    color: var(--text-main);
    margin: 0;
    line-height: 1.5;
    background: rgba(0,0,0,0.02);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.03);
}
