/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    min-height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: #333;
    background: #f8f9fa;
    margin: 0;
    padding: 0;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Screen management */
.screen {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.screen.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Export Screen Styles */
#export-screen {
    max-width: 900px;
    margin: 32px auto 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 24px;
}

#export-screen > *:last-child {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Success Screen Styles */
#success-screen {
    padding: 40px 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.export-format {
    display: flex;
    align-items: center;
    gap: 12px;
}

.export-format .format-label {
    font-weight: 500;
    color: #666;
}

.export-format .format-select {
    font-weight: 600;
    color: #333;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 14px;
    min-width: 80px;
    cursor: pointer;
}

.export-format .format-select:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}

/* Section styles */
.section {
    margin-bottom: 16px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.section-header input[type="radio"] {
    margin: 0;
}

.section-header label {
    font-weight: 500;
    color: #333;
    cursor: pointer;
}

/* Trigger groups */
.trigger-groups {
    margin-left: 24px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    min-height: 60px;
    transition: all 0.3s ease;
}

.loading {
    color: #666;
    font-style: italic;
}

.trigger-group-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.trigger-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 20px;
    font-size: 13px;
    color: #1976d2;
    animation: slideInTag 0.3s ease-out;
    transition: all 0.2s ease;
}

@keyframes slideInTag {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.trigger-tag .remove {
    cursor: pointer;
    font-weight: bold;
    margin-left: 4px;
}

.trigger-tag .remove:hover {
    color: #d32f2f;
}

/* Filter options */
.filter-options {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 14px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.filter-label {
    font-weight: 500;
    color: #495057;
    min-width: fit-content;
}

.filter-radios {
    display: flex;
    gap: 20px;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

.filter-option input[type="radio"] {
    margin: 0;
}

/* Checkbox option styles */
.checkbox-option {
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.checkbox-content {
    flex: 1;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 4px;
}

.checkbox-label input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    accent-color: #9ccc3a;
}

.checkbox-text {
    color: #333;
    font-weight: 400;
}

.checkbox-description {
    margin-left: 24px;
    color: #666;
    font-size: 13px;
    line-height: 1.4;
    margin-top: 4px;
}

.additional-options {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

/* Field selection */
.field-selection {
    margin: 20px 0;
    padding: 16px;
    background: #fafafa;
    border-radius: 6px;
}

.field-columns {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

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

.field-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    position: relative;
}

.field-group input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
    accent-color: #9ccc3a;
}

.field-group label::before {
    content: '';
    display: none;
    position: absolute;
    left: 2px;
    top: 2px;
    width: 12px;
    height: 12px;
    background-color: #9ccc3a;
    border-radius: 2px;
    pointer-events: none;
}

.field-group input[type="checkbox"]:checked + span {
    color: #333;
    font-weight: 500;
}

/* Footer */
.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid #eee;
    margin-top: 20px;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.footer-right {
    display: flex;
    align-items: center;
}

.import-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.trigger-count {
    font-weight: 500;
    color: #666;
}

.actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon {
    flex-shrink: 0;
}

.btn-primary {
    background: #9ccc3a;
    color: white;
}

.btn-primary:hover {
    background: #8bb32e;
}

.btn-secondary {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #eee;
}

.btn-large {
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
}

.btn-help {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
    padding: 8px 16px;
    font-size: 13px;
    gap: 6px;
}

.btn-help:hover {
    background: #eee;
    color: #555;
}

.enterprise-label {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: rgba(147, 51, 234, 0.1);
    color: #9333ea;
    border: none;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.enterprise-label:hover {
    background: rgba(147, 51, 234, 0.15);
    color: #7c3aed;
}

/* Disabled button styling */
.btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-disabled:hover {
    background: #f5f5f5 !important;
    color: #666 !important;
}

/* Success Screen Styles */
#success-screen.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #f8f9fa;
    position: relative;
}

.success-content {
    text-align: center;
    max-width: 500px;
    padding: 48px 24px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
}

.back-btn {
    position: absolute;
    top: 24px;
    left: 24px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    color: #666;
    font-size: 14px;
}

.back-btn:hover {
    background: #f5f5f5;
}

.success-icon {
    margin-bottom: 24px;
    color: #9ccc3a;
}

.success-icon svg {
    display: block;
    margin: 0 auto;
}

.success-content h1 {
    font-size: 48px;
    font-weight: 700;
    color: #333;
    margin-bottom: 24px;
}

.success-message {
    font-size: 18px;
    color: #666;
    margin-bottom: 32px;
    line-height: 1.5;
}

.cta-message {
    font-size: 18px;
    color: #333;
    margin-bottom: 32px;
    font-weight: 500;
}

.bottom-message {
    margin: 32px 0;
    color: #666;
    font-size: 14px;
    text-align: center;
}

.bottom-message a {
    color: #9ccc3a;
    text-decoration: none;
}

.bottom-message a:hover {
    text-decoration: underline;
}

/* Responsive design */
@media (max-width: 768px) {
    #export-screen {
        margin: 0;
        border-radius: 0;
        padding: 16px;
    }
    
    .field-columns {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 16px;
    }
    
    .footer {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
        padding-top: 12px;
    }
    
    .footer-left,
    .footer-right {
        justify-content: center;
    }
    
    .actions {
        justify-content: center;
    }
    
    .section {
        margin-bottom: 12px;
    }
    
    .field-selection {
        margin: 16px 0;
        padding: 12px;
    }
}

@media (min-width: 1200px) {
    #export-screen {
        max-width: 1100px;
    }
    
    .field-columns {
        grid-template-columns: 1fr 1fr 1fr 1fr;
        gap: 20px;
    }
    
    #other-apps-grid, #other-apps-grid-success {
        max-width: 900px;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

/* Loading and disabled states */
.loading {
    opacity: 0.6;
}

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

/* Custom checkbox styling */
input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #9ccc3a;
}

input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #9ccc3a;
}

/* Other Apps Section */
#other-apps-section {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

#other-apps-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    text-align: center;
    margin-bottom: 16px;
}

#other-apps-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #e5e5e5;
    border-top: 2px solid #9ccc3a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

#other-apps-grid, #other-apps-grid-success {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    max-width: 750px;
    margin: 0 auto;
}

.other-app-card {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 16px;
    padding: 28px;
    text-align: center;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    text-decoration: none;
    color: inherit;
    min-height: 260px;
    min-width: 260px;
}

.other-app-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
    text-decoration: none;
    color: inherit;
}

.other-app-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 15px;
    margin: 0 auto 16px;
    display: block;
}

.other-app-logo-placeholder {
    width: 120px;
    height: 120px;
    background: #f5f5f5;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: #999;
}

.other-app-name {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    line-height: 1.2;
}

.other-app-description {
    font-size: 16px;
    color: #666;
    line-height: 1.4;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 48px;
}

.other-app-cta {
    display: inline-block;
    padding: 10px 16px;
    background: #e8f4fd;
    color: #0066cc;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.other-app-card:hover .other-app-cta {
    background: #d1e9f8;
}

#other-apps-error, #other-apps-error-success {
    text-align: center;
    color: #666;
    padding: 32px;
}

/* Responsive adjustments for other apps */
@media (max-width: 768px) {
    #other-apps-grid, #other-apps-grid-success {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 12px;
    }
    
    .other-app-card {
        padding: 24px;
        min-width: 220px;
        min-height: 220px;
    }

    .other-app-logo,
    .other-app-logo-placeholder {
        width: 100px;
        height: 100px;
        border-radius: 12px;
        margin: 0 auto 12px;
    }

    .other-app-name {
        font-size: 16px;
    }

    .other-app-description {
        font-size: 14px;
    }

    .other-app-cta {
        font-size: 14px;
        padding: 8px 14px;
    }
}

/* Name Resolution Progress Screen */
#name-resolution-screen.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #f8f9fa;
    position: relative;
}

.loading-content {
    max-width: 600px;
    width: 100%;
    padding: 48px 24px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
}

.loading-header {
    margin-bottom: 40px;
}

.loading-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.loading-header p {
    color: #666;
    font-size: 14px;
    margin: 0;
}

/* Progress Container */
.progress-container {
    margin-bottom: 32px;
}

.progress-items {
    margin-bottom: 32px;
    text-align: left;
}

.progress-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
}

.progress-item:last-child {
    border-bottom: none;
}

.progress-item.completed {
    opacity: 0.7;
}

.progress-item.active {
    background-color: #f8f9fa;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 0 -16px;
}

.progress-icon {
    width: 24px;
    height: 24px;
    position: relative;
    flex-shrink: 0;
}

.progress-icon .loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e5e5e5;
    border-top: 2px solid #9ccc3a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.progress-icon .progress-check {
    color: #9ccc3a;
}

.progress-text {
    flex: 1;
}

.progress-label {
    font-weight: 500;
    color: #333;
    font-size: 14px;
    margin-bottom: 4px;
}

.progress-detail {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

/* Progress Bar */
.progress-summary {
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e5e5e5;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #9ccc3a, #8bb32e);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-status {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* Loading Actions */
.loading-actions {
    margin-top: 24px;
}

/* Animation states */
.progress-item.completed .loading-spinner {
    display: none;
}

.progress-item.completed .progress-check {
    display: block;
}

.progress-item.error .progress-icon {
    color: #d32f2f;
}

.progress-item.error .loading-spinner {
    border-top-color: #d32f2f;
}

/* Responsive adjustments for progress screen */
@media (max-width: 768px) {
    .loading-content {
        margin: 16px;
        padding: 32px 20px;
    }
    
    .progress-item {
        gap: 12px;
    }
    
    .progress-item.active {
        margin: 0 -12px;
        padding: 12px;
    }
    
    .loading-header h2 {
        font-size: 20px;
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px 24px;
}

.modal-body p {
    margin: 0;
    color: #666;
    line-height: 1.5;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px 20px;
    border-top: 1px solid #eee;
} 