/* CaptionGenius Frontend Styles */

.cg-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.cg-header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.cg-header h2 {
    color: white;
    font-size: 36px;
    margin: 0 0 10px 0;
    font-weight: 700;
}

.cg-header p {
    font-size: 18px;
    margin: 0;
    opacity: 0.95;
}

.cg-form {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.cg-form-group {
    margin-bottom: 25px;
}

.cg-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

/* Upload Area */
.cg-upload-area {
    position: relative;
    border: 3px dashed #667eea;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9ff;
}

.cg-upload-area:hover {
    border-color: #764ba2;
    background: #f0f3ff;
}

.cg-upload-area.cg-dragover {
    border-color: #764ba2;
    background: #e8ebff;
    transform: scale(1.02);
}

.cg-upload-placeholder {
    pointer-events: none;
}

.cg-upload-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    color: #667eea;
}

.cg-upload-placeholder p {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: #333;
}

.cg-upload-placeholder span {
    font-size: 14px;
    color: #666;
}

.cg-image-preview {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.cg-image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 10px;
    display: block;
}

.cg-remove-image {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.cg-remove-image:hover {
    background: rgba(255, 0, 0, 1);
    transform: scale(1.1);
}

/* Text Input */
.cg-textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.cg-textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* Platform Selection */
.cg-platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.cg-platform-option {
    cursor: pointer;
}

.cg-platform-option input[type="radio"] {
    display: none;
}

.cg-platform-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    transition: all 0.3s ease;
    background: white;
}

.cg-platform-option:hover .cg-platform-card {
    border-color: #667eea;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.cg-platform-option input[type="radio"]:checked + .cg-platform-card {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.cg-platform-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.cg-platform-card span:last-child {
    font-size: 14px;
    font-weight: 600;
}

/* Select Inputs */
.cg-select {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.cg-select:focus {
    outline: none;
    border-color: #667eea;
}

/* Generate Button */
.cg-btn-generate {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.cg-btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.cg-btn-generate:active {
    transform: translateY(0);
}

.cg-btn-generate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.cg-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: cg-spin 0.8s linear infinite;
}

@keyframes cg-spin {
    to { transform: rotate(360deg); }
}

/* Results Section */
.cg-results {
    background: white;
    padding: 30px;
    border-radius: 15px;
    margin-top: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.cg-results-title {
    text-align: center;
    font-size: 24px;
    margin: 0 0 25px 0;
    color: #333;
}

.cg-captions-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cg-caption-card {
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f3ff 100%);
    padding: 25px;
    border-radius: 12px;
    border-left: 4px solid #667eea;
    position: relative;
    transition: all 0.3s ease;
}

.cg-caption-card:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.15);
}

.cg-caption-number {
    font-size: 14px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 10px;
}

.cg-caption-text {
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    margin-bottom: 15px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.cg-caption-actions {
    display: flex;
    justify-content: flex-end;
}

.cg-btn-copy {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.cg-btn-copy:hover {
    background: #764ba2;
    transform: translateY(-2px);
}

.cg-btn-copy.copied {
    background: #10b981;
}

/* Error Message */
.cg-error {
    background: #fee;
    border: 2px solid #fcc;
    color: #c33;
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
    text-align: center;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cg-container {
        padding: 25px;
        margin: 20px auto;
    }
    
    .cg-header h2 {
        font-size: 28px;
    }
    
    .cg-form {
        padding: 20px;
    }
    
    .cg-platform-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cg-upload-area {
        padding: 30px 15px;
    }
    
    .cg-upload-icon {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .cg-container {
        padding: 20px;
        margin: 15px;
    }
    
    .cg-platform-grid {
        grid-template-columns: 1fr;
    }
}

/* Label fix */
.cg-upload-label {
    display: block;
    cursor: pointer;
    width: 100%;
}

/* Hide the file input completely */
#cg-image-input {
    position: absolute !important;
    width: 0.1px !important;
    height: 0.1px !important;
    opacity: 0 !important;
    overflow: hidden !important;
    z-index: -1 !important;
}

/* Make label clickable */
label.cg-upload-area {
    display: block;
    cursor: pointer;
}

/* Prevent pointer events on children so label click works */
.cg-upload-placeholder,
.cg-upload-placeholder * {
    pointer-events: none;
}

/* But allow clicks on remove button */
.cg-image-preview,
.cg-remove-image {
    pointer-events: auto;
}