/* AI Business Plan Generator - Frontend Styles */

/* Base responsive setup */
* {
    box-sizing: border-box;
}

/* Improve focus accessibility */
.aibp-btn:focus,
.aibp-form-group input:focus,
.aibp-form-group select:focus,
.aibp-form-group textarea:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Smooth scrolling for better UX */
html {
    scroll-behavior: smooth;
}

.aibp-form-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

.aibp-form-wrapper {
    background: #ffffff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    box-sizing: border-box;
}

.aibp-form-wrapper h2 {
    font-size: clamp(24px, 4vw, 32px);
    margin-bottom: 10px;
    color: #2c3e50;
    text-align: center;
    line-height: 1.2;
}

.aibp-intro {
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 30px;
    font-size: clamp(14px, 2.5vw, 16px);
    line-height: 1.5;
    padding: 0 10px;
}

/* Progress Bar */
.aibp-progress-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    position: relative;
    padding: 0 10px;
}

.aibp-progress-bar::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: #e0e0e0;
    z-index: 0;
}

.aibp-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    flex: 1;
    min-width: 0;
}

.step-number {
    width: clamp(35px, 8vw, 40px);
    height: clamp(35px, 8vw, 40px);
    border-radius: 50%;
    background: #e0e0e0;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    font-size: clamp(12px, 3vw, 16px);
}

.aibp-progress-step.active .step-number {
    background: #3498db;
    color: white;
}

.step-label {
    font-size: clamp(10px, 2.5vw, 12px);
    color: #999;
    text-align: center;
    line-height: 1.2;
    word-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
}

.aibp-progress-step.active .step-label {
    color: #2c3e50;
    font-weight: 600;
}

/* Form Steps */
.aibp-form-step {
    display: none;
}

.aibp-form-step.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.aibp-form-step h3 {
    font-size: clamp(20px, 4vw, 24px);
    margin-bottom: 25px;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
    line-height: 1.3;
}

/* Form Groups */
.aibp-form-group {
    margin-bottom: clamp(20px, 4vw, 25px);
}

.aibp-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: clamp(13px, 2.5vw, 14px);
    line-height: 1.4;
}

.aibp-form-group input[type="text"],
.aibp-form-group select,
.aibp-form-group textarea {
    width: 100%;
    padding: clamp(10px, 2.5vw, 12px) clamp(12px, 3vw, 15px);
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: clamp(14px, 3vw, 15px);
    transition: border-color 0.3s ease;
    font-family: inherit;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.aibp-form-group input[type="text"]:focus,
.aibp-form-group select:focus,
.aibp-form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.aibp-form-group input.error,
.aibp-form-group select.error,
.aibp-form-group textarea.error {
    border-color: #e74c3c;
}

.aibp-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Form Actions */
.aibp-form-actions {
    display: flex;
    gap: clamp(10px, 3vw, 15px);
    margin-top: clamp(25px, 5vw, 30px);
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* Buttons */
.aibp-btn {
    padding: clamp(12px, 3vw, 14px) clamp(20px, 5vw, 30px);
    border: none;
    border-radius: 6px;
    font-size: clamp(14px, 3.5vw, 16px);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    min-height: 44px;
    min-width: 120px;
    box-sizing: border-box;
    touch-action: manipulation;
}

.aibp-btn-next,
.aibp-btn-submit {
    background: #3498db;
    color: white;
}

.aibp-btn-next:hover,
.aibp-btn-submit:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.aibp-btn-prev {
    background: #95a5a6;
    color: white;
}

.aibp-btn-prev:hover {
    background: #7f8c8d;
}

.aibp-btn-secondary {
    background: #ecf0f1;
    color: #2c3e50;
}

.aibp-btn-secondary:hover {
    background: #bdc3c7;
}

.aibp-btn-download {
    background: #27ae60;
    color: white;
    margin-right: 10px;
}

.aibp-btn-download:hover {
    background: #229954;
}

/* Loading State */
.aibp-loading {
    text-align: center;
    padding: 60px 40px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 20px;
}

.aibp-loading-title {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
    margin: 20px 0 10px;
}

.aibp-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.aibp-loading-text {
    font-size: 18px;
    color: #34495e;
    margin: 15px 0;
    font-weight: 500;
}

.aibp-loading-subtext {
    font-size: 14px;
    color: #7f8c8d;
    margin-top: 25px;
}

/* Progress Bar */
.aibp-progress-container {
    margin: 30px auto;
    max-width: 600px;
}

.aibp-progress-bar-track {
    width: 100%;
    height: 12px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.aibp-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 10px;
    transition: width 0.5s ease;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

.aibp-progress-percentage {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #3498db;
    margin-top: 10px;
}

/* Progress Steps */
.aibp-progress-steps {
    display: flex;
    justify-content: space-around;
    margin: 30px 0 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.aibp-progress-step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0.3;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 100px;
}

.aibp-progress-step-item.active {
    opacity: 1;
    transform: scale(1.1);
}

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

.aibp-progress-step-item .step-icon {
    font-size: 32px;
    filter: grayscale(100%);
    transition: filter 0.3s ease;
}

.aibp-progress-step-item.active .step-icon {
    filter: grayscale(0%);
    animation: pulse 1.5s ease-in-out infinite;
}

.aibp-progress-step-item.completed .step-icon {
    filter: grayscale(0%);
}

.aibp-progress-step-item .step-text {
    font-size: 12px;
    color: #7f8c8d;
    font-weight: 500;
    text-align: center;
}

.aibp-progress-step-item.active .step-text {
    color: #2c3e50;
    font-weight: 600;
}

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

/* Result State */
.aibp-result {
    text-align: center;
    padding: 60px 20px;
}

.aibp-success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #27ae60;
    color: white;
    font-size: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.aibp-result h3 {
    font-size: 28px;
    margin-bottom: 15px;
    color: #2c3e50;
}

.aibp-result p {
    font-size: 16px;
    color: #7f8c8d;
    margin-bottom: 30px;
}

/* Error State */
.aibp-error-message {
    text-align: center;
    padding: 40px 20px;
    background: #fee;
    border: 2px solid #e74c3c;
    border-radius: 8px;
    margin-top: 20px;
}

.aibp-error-icon {
    font-size: 48px;
    margin-bottom: 15px;
    color: #f39c12;
}

.aibp-error-message p {
    color: #c0392b;
    font-size: 16px;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Error class for form fields */
.aibp-error {
    background: #fee;
    border: 2px solid #e74c3c;
    padding: 15px;
    border-radius: 6px;
    color: #c0392b;
    margin: 20px 0;
}

/* Responsive Design */

/* Tablet Styles */
@media (max-width: 1024px) and (min-width: 769px) {
    .aibp-form-container {
        margin: 30px auto;
        padding: 15px;
    }
    
    .aibp-form-wrapper {
        padding: 30px;
    }
    
    .aibp-progress-bar {
        margin-bottom: 35px;
    }
    
    .aibp-form-actions {
        justify-content: center;
        gap: 20px;
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    .aibp-form-container {
        margin: 20px auto;
        padding: 10px;
    }
    
    .aibp-form-wrapper {
        padding: 20px;
        border-radius: 8px;
        margin: 0;
    }
    
    .aibp-intro {
        margin-bottom: 25px;
        padding: 0 5px;
    }
    
    .aibp-progress-bar {
        margin-bottom: 30px;
        padding: 0 5px;
    }
    
    .aibp-progress-bar::before {
        left: 15%;
        right: 15%;
    }
    
    .step-label {
        font-size: 10px;
        margin-top: 4px;
    }
    
    .aibp-form-step h3 {
        margin-bottom: 20px;
        padding-bottom: 8px;
    }
    
    .aibp-form-group {
        margin-bottom: 20px;
    }
    
    .aibp-form-group label {
        margin-bottom: 6px;
    }
    
    .aibp-form-group input[type="text"],
    .aibp-form-group select,
    .aibp-form-group textarea {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .aibp-form-group textarea {
        min-height: 100px;
    }
    
    .aibp-form-actions {
        flex-direction: column;
        gap: 12px;
        margin-top: 25px;
    }
    
    .aibp-btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 16px;
        min-height: 48px;
    }
}

/* Small Mobile Styles */
@media (max-width: 480px) {
    .aibp-form-container {
        margin: 10px auto;
        padding: 5px;
    }
    
    .aibp-form-wrapper {
        padding: 15px;
        border-radius: 6px;
    }
    
    .aibp-progress-bar {
        margin-bottom: 25px;
        padding: 0;
    }
    
    .aibp-progress-bar::before {
        left: 20%;
        right: 20%;
    }
    
    .step-label {
        font-size: 9px;
        line-height: 1.1;
    }
    
    .aibp-form-group input[type="text"],
    .aibp-form-group select,
    .aibp-form-group textarea {
        padding: 10px;
    }
    
    .aibp-btn {
        padding: 12px 15px;
        min-height: 44px;
    }
}

/* Modal Styles */
.aibp-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.aibp-modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

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

.aibp-modal-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 24px;
}

.aibp-modal-close {
    background: none;
    border: none;
    font-size: 30px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

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

.aibp-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    position: relative;
}

.aibp-preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #666;
}

.aibp-preview-loading .aibp-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.aibp-preview-content {
    padding: 30px;
    line-height: 1.6;
    color: #333;
}

.aibp-preview-content h1,
.aibp-preview-content h2,
.aibp-preview-content h3,
.aibp-preview-content h4,
.aibp-preview-content h5,
.aibp-preview-content h6 {
    color: #2c3e50;
    margin-top: 30px;
    margin-bottom: 15px;
}

.aibp-preview-content h1 {
    font-size: 28px;
    border-bottom: 3px solid #3498db;
    padding-bottom: 10px;
    text-align: center;
}

.aibp-preview-content h2 {
    font-size: 24px;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 8px;
}

.aibp-preview-content h3 {
    font-size: 20px;
    color: #34495e;
}

.aibp-preview-content p {
    margin-bottom: 15px;
    text-align: justify;
}

.aibp-preview-content ul,
.aibp-preview-content ol {
    margin-bottom: 15px;
    padding-left: 30px;
}

.aibp-preview-content li {
    margin-bottom: 8px;
}

.aibp-preview-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.aibp-preview-content th,
.aibp-preview-content td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.aibp-preview-content th {
    background-color: #f8f9fa;
    font-weight: bold;
}

.aibp-modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.aibp-result-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Modal Responsive Styles */

/* Tablet Modal Styles */
@media (max-width: 1024px) and (min-width: 769px) {
    .aibp-modal-content {
        width: 90%;
        max-height: 90vh;
    }
    
    .aibp-modal-header h3 {
        font-size: 22px;
    }
    
    .aibp-preview-content {
        padding: 25px;
    }
}

/* Mobile Modal Styles */
@media (max-width: 768px) {
    .aibp-modal-content {
        width: 95%;
        max-height: 95vh;
        margin: 10px;
        border-radius: 8px;
    }
    
    .aibp-modal-header,
    .aibp-modal-footer {
        padding: 15px 20px;
    }
    
    .aibp-modal-header h3 {
        font-size: clamp(18px, 4vw, 20px);
        line-height: 1.3;
    }
    
    .aibp-modal-close {
        font-size: 24px;
        padding: 5px;
        min-width: 30px;
        min-height: 30px;
    }
    
    .aibp-preview-content {
        padding: 15px;
        font-size: 14px;
        line-height: 1.5;
    }
    
    .aibp-preview-content table {
        font-size: 13px;
    }
    
    .aibp-preview-content th,
    .aibp-preview-content td {
        padding: 8px;
    }
    
    .aibp-modal-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .aibp-result-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .aibp-result-buttons .aibp-btn {
        width: 100%;
        min-height: 44px;
    }
}

/* Small Mobile Modal Styles */
@media (max-width: 480px) {
    .aibp-modal-content {
        width: 98%;
        max-height: 98vh;
        margin: 5px;
        border-radius: 6px;
    }
    
    .aibp-modal-header,
    .aibp-modal-footer {
        padding: 12px 15px;
    }
    
    .aibp-modal-header h3 {
        font-size: 16px;
    }
    
    .aibp-preview-content {
        padding: 12px;
        font-size: 13px;
    }
    
    .aibp-preview-content table {
        font-size: 12px;
    }
    
    .aibp-preview-content th,
    .aibp-preview-content td {
        padding: 6px;
    }
}

/* User Details Modal Specific Styles */
#aibp-user-details-modal .aibp-modal-content {
    max-width: 500px;
    width: 90%;
}

#aibp-user-details-modal .aibp-modal-body {
    padding: 30px;
}

#aibp-user-details-modal .aibp-modal-body p {
    margin-bottom: 20px;
    color: #555;
    line-height: 1.5;
}

#aibp-user-details-modal .aibp-form-group {
    margin-bottom: 20px;
}

#aibp-user-details-modal .aibp-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

#aibp-user-details-modal .aibp-form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

#aibp-user-details-modal .aibp-form-group input:focus {
    border-color: #3498db;
    outline: none;
}

#aibp-user-details-modal .aibp-error-message {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 12px;
    border-radius: 6px;
    margin-top: 15px;
}

#aibp-user-details-modal .aibp-modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

#aibp-user-details-modal .aibp-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

#aibp-user-details-modal .aibp-btn-secondary {
    background: #95a5a6;
    color: white;
}

#aibp-user-details-modal .aibp-btn-secondary:hover {
    background: #7f8c8d;
}

#aibp-user-details-modal .aibp-btn-primary {
    background: #3498db;
    color: white;
}

#aibp-user-details-modal .aibp-btn-primary:hover {
    background: #2980b9;
}

#aibp-user-details-modal .aibp-btn-primary:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

/* Responsive adjustments for user details modal */
@media (max-width: 768px) {
    #aibp-user-details-modal .aibp-modal-content {
        width: 95%;
        margin: 20px;
    }
    
    #aibp-user-details-modal .aibp-modal-body {
        padding: 20px;
    }
    
    #aibp-user-details-modal .aibp-modal-footer {
        padding: 15px 20px;
        flex-direction: column;
    }
    
    #aibp-user-details-modal .aibp-btn {
        width: 100%;
        margin-bottom: 10px;
    }
}
