/**
 * Frontend Styles
 * Path: assets/css/frontend.css
 */

.apf-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    position: relative;
}

.apf-header {
    text-align: center;
    margin-bottom: 40px;
}

.apf-title {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 10px 0;
}

.apf-subtitle {
    font-size: 18px;
    color: #666;
    margin: 0;
}

.apf-form {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 10px 20px rgba(0, 0, 0, 0.08);
}

.apf-form-group {
    margin-bottom: 30px;
}

.apf-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

/* Frame Selection */
.apf-frames-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}

.apf-frame-option input[type="radio"] {
    display: none;
}

.apf-frame-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    border: 3px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
}

.apf-frame-label:hover {
    border-color: #999;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.apf-frame-option input[type="radio"]:checked + .apf-frame-label {
    border-color: #0073aa;
    background: #f0f8ff;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.2);
}

.apf-frame-preview {
    width: 100px;
    height: 100px;
    object-fit: contain;
    margin-bottom: 10px;
}

.apf-frame-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    text-align: center;
}

/* Upload Area */
.apf-upload-area {
    position: relative;
    border: 3px dashed #d0d0d0;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s ease;
    background: #fafafa;
    cursor: pointer;
}

.apf-upload-area:hover {
    border-color: #0073aa;
    background: #f0f8ff;
}

.apf-upload-area.has-file {
    border-style: solid;
    border-color: #00a32a;
}

.apf-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.apf-upload-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 15px;
    color: #0073aa;
}

.apf-upload-text {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 5px 0;
}

.apf-upload-hint {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.apf-image-preview {
    margin-top: 20px;
}

.apf-image-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Buttons */
.apf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    width: 100%;
}

.apf-btn-primary {
    background: linear-gradient(135deg, #0073aa 0%, #005177 100%);
    color: #fff;
}

.apf-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 115, 170, 0.4);
}

.apf-btn-secondary {
    background: #f0f0f1;
    color: #333;
}

.apf-btn-secondary:hover {
    background: #dcdcde;
}

.apf-btn-facebook {
    background: linear-gradient(135deg, #1877f2 0%, #0d5cbd 100%);
    color: #fff;
}

.apf-btn-facebook:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(24, 119, 242, 0.4);
}

.apf-btn-icon {
    width: 20px;
    height: 20px;
}

.apf-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.apf-btn.loading .apf-btn-text {
    opacity: 0;
}

.apf-btn.loading .apf-btn-loader {
    display: block;
}

.apf-btn-loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    position: absolute;
}

/* Result Section */
.apf-result-section {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 10px 20px rgba(0, 0, 0, 0.08);
}

.apf-result-header {
    text-align: center;
    margin-bottom: 30px;
}

.apf-result-image-wrapper {
    text-align: center;
    margin-bottom: 30px;
}

.apf-result-image {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.apf-result-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.apf-result-description {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    color: #555;
    line-height: 1.6;
}

/* Loading Overlay */
.apf-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    z-index: 1000;
}

.apf-loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #f0f0f1;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.apf-loading-text {
    margin-top: 20px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.apf-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

/* Responsive Design */
@media (min-width: 768px) {
    .apf-result-actions {
        grid-template-columns: 1fr 1fr;
    }
    
    .apf-result-actions .apf-btn:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .apf-container {
        padding: 0 15px;
        margin: 20px auto;
    }
    
    .apf-title {
        font-size: 24px;
    }
    
    .apf-subtitle {
        font-size: 16px;
    }
    
    .apf-form,
    .apf-result-section {
        padding: 25px;
    }
    
    .apf-frames-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .apf-frame-label {
        padding: 10px;
    }
    
    .apf-frame-preview {
        width: 70px;
        height: 70px;
    }
    
    .apf-upload-area {
        padding: 30px 15px;
    }
}