/* ==========================================================================
   Candidaturas Concurso - Form Styles
   ========================================================================== */

/* Variables */
.cc-form-wrapper {
    --cc-primary: #2563eb;
    --cc-secondary: #1e40af;
    --cc-success: #16a34a;
    --cc-error: #dc2626;
    --cc-gray-50: #f9fafb;
    --cc-gray-100: #f3f4f6;
    --cc-gray-200: #e5e7eb;
    --cc-gray-300: #d1d5db;
    --cc-gray-400: #9ca3af;
    --cc-gray-500: #6b7280;
    --cc-gray-600: #4b5563;
    --cc-gray-700: #374151;
    --cc-gray-800: #1f2937;
    --cc-gray-900: #111827;
    --cc-radius: 8px;
    --cc-shadow: 0 1px 3px rgba(0,0,0,0.1);
    --cc-shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

/* Reset - Aplicar apenas dentro do wrapper */
.cc-form-wrapper *,
.cc-form-wrapper *::before,
.cc-form-wrapper *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Wrapper */
.cc-form-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
    color: var(--cc-gray-800) !important;
}

/* Header */
.cc-form-header {
    text-align: center;
    margin-bottom: 30px;
}

.cc-form-header h2 {
    margin: 0 0 10px;
    font-size: 28px;
    font-weight: 700;
    color: var(--cc-gray-900);
}

.cc-form-header p {
    margin: 0;
    color: var(--cc-gray-500);
}

/* Progress */
.cc-progress {
    margin-bottom: 30px;
}

.cc-progress-bar {
    height: 6px;
    background: var(--cc-gray-200);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 15px;
}

.cc-progress-fill {
    height: 100%;
    background: var(--cc-primary);
    transition: width 0.3s ease;
}

.cc-progress-steps {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 5px;
}

.cc-step {
    font-size: 12px;
    color: var(--cc-gray-400);
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.cc-step.active {
    color: var(--cc-primary);
    font-weight: 600;
}

.cc-step.completed {
    color: var(--cc-success);
}

/* Form */
.cc-form-wrapper .cc-form {
    background: #fff !important;
    border-radius: var(--cc-radius) !important;
    box-shadow: var(--cc-shadow) !important;
    padding: 30px !important;
}

/* Steps - CRÍTICO: esconder steps não activos */
.cc-form-wrapper .cc-form-step {
    display: none !important;
}

.cc-form-wrapper .cc-form-step.active {
    display: block !important;
    animation: fadeIn 0.3s ease;
}

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

.cc-form-step h3 {
    margin: 0 0 20px;
    font-size: 22px;
    font-weight: 600;
    color: var(--cc-gray-900);
}

.cc-form-intro {
    color: var(--cc-gray-500);
    margin-bottom: 20px;
}

/* Form Groups */
.cc-form-wrapper .cc-form-group {
    margin-bottom: 20px !important;
}

.cc-form-wrapper .cc-form-group label {
    display: block !important;
    margin-bottom: 6px !important;
    font-weight: 500 !important;
    color: var(--cc-gray-700) !important;
    font-size: 14px !important;
}

.cc-form-wrapper .cc-form-group .required {
    color: var(--cc-error) !important;
}

.cc-form-wrapper .cc-form-group input[type="text"],
.cc-form-wrapper .cc-form-group input[type="email"],
.cc-form-wrapper .cc-form-group input[type="tel"],
.cc-form-wrapper .cc-form-group input[type="url"],
.cc-form-wrapper .cc-form-group input[type="number"],
.cc-form-wrapper .cc-form-group select,
.cc-form-wrapper .cc-form-group textarea {
    width: 100% !important;
    padding: 12px 14px !important;
    border: 1px solid var(--cc-gray-300) !important;
    border-radius: var(--cc-radius) !important;
    font-size: 16px !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
    background: #fff !important;
    color: var(--cc-gray-800) !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.cc-form-wrapper .cc-form-group select {
    padding-right: 40px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23555' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 12px !important;
    cursor: pointer !important;
}

.cc-form-wrapper .cc-form-group input:focus,
.cc-form-wrapper .cc-form-group select:focus,
.cc-form-wrapper .cc-form-group textarea:focus {
    outline: none !important;
    border-color: var(--cc-primary) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
}

.cc-form-wrapper .cc-form-group input.error,
.cc-form-wrapper .cc-form-group select.error {
    border-color: var(--cc-error) !important;
}

.cc-form-help {
    font-size: 14px;
    color: var(--cc-gray-500);
    margin-top: 6px;
}

.cc-form-help a {
    color: var(--cc-primary);
    text-decoration: none;
}

.cc-form-help a:hover {
    text-decoration: underline;
}

/* Phone Field with Country Code */
.cc-phone-field {
    display: flex !important;
    gap: 0 !important;
    align-items: stretch !important;
}

.cc-form-wrapper .cc-form-group .cc-phone-field .cc-country-code,
.cc-phone-field .cc-country-code {
    width: auto !important;
    min-width: 130px !important;
    max-width: 130px !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    border-radius: var(--cc-radius) 0 0 var(--cc-radius) !important;
    border-right: none !important;
    font-size: 14px !important;
    padding: 10px 28px 10px 8px !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23555' d='M1.17 0L5 3.82 8.83 0 10 1.18l-5 5-5-5z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 8px center !important;
    background-size: 10px !important;
    cursor: pointer !important;
}

.cc-form-wrapper .cc-form-group .cc-phone-field input[type="tel"],
.cc-phone-field input[type="tel"] {
    flex: 1 !important;
    width: auto !important;
    border-radius: 0 var(--cc-radius) var(--cc-radius) 0 !important;
    min-width: 0 !important;
}

.cc-phone-field .cc-country-code:focus {
    z-index: 1;
}

/* Form Row */
.cc-form-row {
    display: flex;
    gap: 20px;
}

.cc-form-group--half {
    flex: 1;
}

@media (max-width: 600px) {
    .cc-form-row {
        flex-direction: column;
        gap: 0;
    }
}

/* Radio Cards */
.cc-form-wrapper .cc-radio-cards {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 15px !important;
}

.cc-form-wrapper .cc-radio-cards--small .cc-radio-card-content {
    padding: 15px !important;
}

.cc-form-wrapper .cc-radio-card {
    cursor: pointer !important;
    display: block !important;
}

.cc-form-wrapper .cc-radio-card input {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.cc-form-wrapper .cc-radio-card-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    padding: 25px 15px !important;
    border: 2px solid var(--cc-gray-200) !important;
    border-radius: var(--cc-radius) !important;
    transition: all 0.2s ease !important;
    background: #fff !important;
}

.cc-form-wrapper .cc-radio-card:hover .cc-radio-card-content {
    border-color: var(--cc-gray-300) !important;
}

.cc-form-wrapper .cc-radio-card input:checked + .cc-radio-card-content {
    border-color: var(--cc-primary) !important;
    background: rgba(37, 99, 235, 0.05) !important;
}

.cc-radio-card-icon {
    font-size: 32px;
    margin-bottom: 10px;
    color: var(--cc-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cc-radio-card-icon svg {
    width: 32px;
    height: 32px;
    stroke: var(--cc-primary);
}

.cc-radio-card-title {
    font-weight: 600;
    color: var(--cc-gray-800);
}

.cc-radio-card-desc {
    font-size: 14px;
    color: var(--cc-gray-500);
    margin-top: 4px;
}

@media (max-width: 500px) {
    .cc-radio-cards {
        grid-template-columns: 1fr;
    }
}

/* Author Block */
.cc-author-block {
    background: var(--cc-gray-50);
    border: 1px solid var(--cc-gray-200);
    border-radius: var(--cc-radius);
    padding: 20px;
    margin-bottom: 20px;
}

.cc-author-block:last-child {
    margin-bottom: 0;
}

.cc-author-title {
    margin: 0 0 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--cc-gray-200);
    font-size: 18px;
    font-weight: 600;
    color: var(--cc-gray-800);
}

/* File Upload */
.cc-file-upload {
    position: relative;
}

.cc-file-input {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.cc-file-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    border: 2px dashed var(--cc-gray-300);
    border-radius: var(--cc-radius);
    background: var(--cc-gray-50);
    transition: all 0.2s ease;
    text-align: center;
}

.cc-file-upload:hover .cc-file-dropzone,
.cc-file-upload.dragover .cc-file-dropzone {
    border-color: var(--cc-primary);
    background: rgba(37, 99, 235, 0.05);
}

.cc-file-icon {
    font-size: 36px;
    margin-bottom: 10px;
    color: var(--cc-gray-400);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cc-file-icon svg {
    width: 36px;
    height: 36px;
    stroke: var(--cc-gray-400);
}

.cc-file-text {
    color: var(--cc-gray-600);
    margin-bottom: 5px;
}

.cc-file-formats {
    font-size: 12px;
    color: var(--cc-gray-400);
}

/* Small file dropzone for CC upload */
.cc-file-dropzone--small {
    padding: 15px;
}

.cc-file-dropzone--small .cc-file-icon {
    margin-bottom: 5px;
}

.cc-file-dropzone--small .cc-file-icon svg {
    width: 24px;
    height: 24px;
}

.cc-file-dropzone--small .cc-file-text {
    font-size: 13px;
}

/* CC info text */
.cc-cc-info {
    font-style: italic;
    color: var(--cc-primary);
    margin-bottom: 8px;
}

.cc-file-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: var(--cc-gray-100);
    border-radius: var(--cc-radius);
    margin-top: 10px;
}

.cc-file-name {
    font-size: 14px;
    color: var(--cc-gray-700);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cc-file-remove,
button.cc-file-remove {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--cc-gray-400) !important;
    cursor: pointer;
    padding: 4px 0 !important;
    font-size: 12px !important;
    line-height: 1;
    transition: color 0.15s ease;
    z-index: 10;
    position: relative;
    flex-shrink: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
    border-radius: 0 !important;
}

.cc-file-remove:hover,
button.cc-file-remove:hover {
    color: var(--cc-error) !important;
    background: none !important;
}

.cc-file-remove:active {
    transform: scale(0.95);
}

.cc-file-progress {
    height: 4px;
    background: var(--cc-gray-200);
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
}

.cc-file-progress-bar {
    height: 100%;
    background: var(--cc-primary);
    width: 0;
    transition: width 0.3s ease;
}

/* Summary */
.cc-summary {
    background: var(--cc-gray-50);
    border-radius: var(--cc-radius);
    padding: 20px;
}

.cc-summary-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--cc-gray-200);
}

.cc-summary-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.cc-summary-title {
    font-weight: 600;
    color: var(--cc-gray-800);
    margin-bottom: 10px;
}

.cc-summary-item {
    display: flex;
    margin-bottom: 8px;
    font-size: 14px;
}

.cc-summary-label {
    color: var(--cc-gray-500);
    min-width: 180px;
}

.cc-summary-value {
    color: var(--cc-gray-800);
    word-break: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}

/* Separator */
.cc-separator {
    display: flex;
    align-items: center;
    margin: 25px 0;
}

.cc-separator::before,
.cc-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--cc-gray-200);
}

.cc-separator span {
    padding: 0 15px;
    color: var(--cc-gray-400);
    font-size: 14px;
}

/* Checkbox */
.cc-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}

.cc-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--cc-primary);
}

/* Buttons */
.cc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    border: none;
    border-radius: var(--cc-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.cc-btn:not(.cc-btn-outline) {
    background: var(--cc-primary);
    color: #fff;
}

.cc-btn:not(.cc-btn-outline):hover {
    background: var(--cc-secondary);
}

.cc-btn-outline {
    background: transparent;
    border: 2px solid var(--cc-gray-300);
    color: var(--cc-gray-700);
}

.cc-btn-outline:hover {
    border-color: var(--cc-gray-400);
    background: var(--cc-gray-50);
}

.cc-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.cc-btn-submit {
    padding: 15px 40px;
    font-size: 18px;
}

/* Form Navigation */
.cc-form-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid var(--cc-gray-200);
}

.cc-form-nav .cc-btn-next {
    margin-left: auto;
}

/* Submit Area */
.cc-submit-area {
    text-align: center;
    margin-top: 30px;
}

/* Final Check */
.cc-final-check {
    background: var(--cc-gray-50);
    border-radius: var(--cc-radius);
    padding: 20px;
}

/* Character Counter */
.cc-char-counter {
    text-align: right;
    font-size: 12px;
    color: var(--cc-gray-400);
    margin-top: 4px;
}

.cc-char-counter.cc-char-near {
    color: #d97706;
}

.cc-char-counter.cc-char-limit {
    color: var(--cc-error);
    font-weight: 500;
}

/* Required Note */
.cc-required-note {
    text-align: center;
    font-size: 11px;
    color: var(--cc-gray-500);
    margin-top: 12px;
    margin-bottom: 0;
    letter-spacing: 0.01em;
}

/* Error Banner (inline) */
.cc-error-banner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    margin-top: 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--cc-radius);
    animation: ccSlideDown 0.25s ease;
}

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

.cc-error-banner-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.cc-error-banner-icon {
    flex-shrink: 0;
    margin-top: 1px;
}

.cc-error-banner-icon svg {
    stroke: #dc2626;
}

.cc-error-banner #cc-error-text {
    font-size: 14px;
    color: #991b1b;
    line-height: 1.5;
}

.cc-error-banner #cc-error-text p {
    margin: 0;
    color: #991b1b;
}

.cc-error-banner #cc-error-text ul {
    margin: 0;
    padding: 0 0 0 18px;
    list-style: disc;
}

.cc-error-banner #cc-error-text li {
    font-size: 13px;
    color: #991b1b;
    line-height: 1.5;
    margin-bottom: 2px;
}

.cc-error-banner #cc-error-text li:last-child {
    margin-bottom: 0;
}

.cc-error-banner-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.cc-error-banner-close svg {
    stroke: #dc2626;
}

.cc-error-banner-close:hover {
    background: #fecaca;
}

/* Messages */
.cc-success-message {
    text-align: center;
    padding: 50px 30px;
    background: #fff;
    border-radius: var(--cc-radius);
    box-shadow: var(--cc-shadow-lg);
}

.cc-success-icon {
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    border-radius: 50%;
    font-size: 36px;
    font-weight: bold;
    background: rgba(22, 163, 74, 0.1);
    color: var(--cc-success);
}

.cc-success-icon svg {
    stroke: var(--cc-success);
}

.cc-success-message h3 {
    color: var(--cc-success);
    margin: 0 0 10px;
}

.cc-success-message p {
    color: var(--cc-gray-600);
    margin: 0 0 20px;
}

/* Inline field errors */
.cc-field-error {
    color: #dc2626;
    font-size: 12px;
    margin-top: 4px;
    display: block;
    line-height: 1.4;
    animation: ccFadeIn 0.2s ease;
}

@keyframes ccFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Radio card error state */
.cc-form-wrapper .cc-radio-card.error .cc-radio-card-content {
    border-color: var(--cc-error) !important;
}

/* File upload error state */
.cc-file-upload.error .cc-file-dropzone {
    border-color: var(--cc-error);
    background: rgba(220, 38, 38, 0.05);
}

.cc-file-upload.error .cc-file-icon svg {
    stroke: var(--cc-error);
}

/* Upload progress states */
.cc-file-upload.uploading .cc-file-dropzone {
    border-color: var(--cc-primary);
    background: rgba(37, 99, 235, 0.05);
}

.cc-file-upload.uploading .cc-file-input {
    pointer-events: none;
}

/* Hidden - CRÍTICO: máxima especificidade */
.cc-form-wrapper .cc-hidden,
.cc-form-wrapper .cc-form .cc-hidden,
.cc-form-wrapper .cc-form-step .cc-hidden,
.cc-hidden.cc-hidden.cc-hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
    .cc-form-wrapper {
        padding: 10px;
    }
    
    .cc-form {
        padding: 20px 15px;
    }
    
    .cc-progress-steps {
        display: none;
    }
    
    .cc-summary-item {
        flex-direction: column;
    }
    
    .cc-summary-label {
        min-width: auto;
        margin-bottom: 2px;
    }
}
