/**
 * IG Caption AI - Frontend Styles
 * Clean SaaS-style UI inspired by Copy.ai
 */

/* Container */
.igcap-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Header */
.igcap-header {
    text-align: center;
    margin-bottom: 40px;
}

.igcap-title {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 12px 0;
    line-height: 1.2;
}

.igcap-subtitle {
    font-size: 16px;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

/* Form Wrapper */
.igcap-form-wrapper {
    background: #ffffff;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.04);
    margin-bottom: 32px;
}

/* Form Groups */
.igcap-form-group {
    margin-bottom: 24px;
}

.igcap-row {
    display: flex;
    gap: 20px;
    margin-left: -10px;
    margin-right: -10px;
}

.igcap-col-half {
    flex: 1;
    min-width: 0;
    padding: 0 10px;
}

/* Labels */
.igcap-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

/* Input */
.igcap-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s ease;
    box-sizing: border-box;
    font-family: inherit;
}

.igcap-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.igcap-input::placeholder {
    color: #9ca3af;
}

/* Help Text */
.igcap-help-text {
    font-size: 13px;
    color: #6b7280;
    margin: 6px 0 0 0;
}

/* Container Box Border */
.igcap-button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;                  
    border: 1px solid #e5e8ee;  
    padding: 20px;              
    border-radius: 16px;        
    background: #fbfcff;        
    margin-top: 5px;
}

.igcap-option-btn {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  border: 1.5px solid #e5e7eb;
  background: #ffffff;
  color: #111827;
  border-radius: 999px; 
  cursor: pointer;
  transition: all 120ms ease-out;
  white-space: nowrap;
}

.igcap-option-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(16,24,40,0.06);
  border-color: #c7d2fe;
  background: #f8fafc;
}

.igcap-option-btn-active {
  background: #e5ebff;     
  border-color: #c7d2fe;
  color: #1e3a8a;          
  font-weight: 600;
  transform: scale(1.02);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.10);
}

.igcap-option-btn-active:hover {
  background: #cdd8ff;
}

/* Generate Button */
.igcap-generate-btn {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.igcap-generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.igcap-generate-btn:active {
    transform: translateY(0);
}

.igcap-generate-btn:disabled {
    opacity: 0.95;
    cursor: not-allowed;
    transform: none;
}

.igcap-btn-text,
.igcap-btn-loader {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.igcap-btn-text svg {
    width: 20px;
    height: 20px;
    animation: igcap-bounce 2s ease-in-out infinite;
}

@keyframes igcap-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

/* Loading States */
.igcap-loader-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.igcap-loader-emoji {
    font-size: 22px;
    animation: igcap-emoji-pulse 1.5s ease-in-out infinite;
    transition: opacity 0.3s ease;
}

.igcap-loader-text {
    font-size: 15px;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

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

/* Progress Bar Animation */
.igcap-generate-btn:disabled::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: rgba(255, 255, 255, 0.4);
    animation: igcap-progress 30s linear forwards;
}

@keyframes igcap-progress {
    0% {
        width: 0%;
    }
    100% {
        width: 100%;
    }
}

/* Spinner */
.igcap-spinner {
    animation: igcap-rotate 2s linear infinite;
    width: 20px;
    height: 20px;
}

.igcap-spinner .path {
    stroke: #ffffff;
    stroke-linecap: round;
    animation: igcap-dash 1.5s ease-in-out infinite;
}

@keyframes igcap-rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes igcap-dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* API Info */
.igcap-api-info {
    text-align: center;
    font-size: 13px;
    color: #9ca3af;
    margin: 12px 0 0 0;
}

/* Loading Indicator */
.igcap-loading-indicator {
    margin: 24px 0;
    animation: igcap-fade-in 0.3s ease-out;
}

@keyframes igcap-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.igcap-loading-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.igcap-loading-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: igcap-shimmer 2s infinite;
}

@keyframes igcap-shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.igcap-loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.igcap-dot {
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: igcap-dot-bounce 1.4s ease-in-out infinite;
}

.igcap-dot:nth-child(1) {
    animation-delay: 0s;
}

.igcap-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.igcap-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes igcap-dot-bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

.igcap-loading-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    color: #ffffff;
}

.igcap-loading-emoji {
    font-size: 28px;
    animation: igcap-emoji-rotate 3s ease-in-out infinite;
    transition: opacity 0.3s ease;
}

@keyframes igcap-emoji-rotate {
    0%, 100% {
        transform: rotate(0deg) scale(1);
    }
    25% {
        transform: rotate(-10deg) scale(1.1);
    }
    75% {
        transform: rotate(10deg) scale(1.1);
    }
}

.igcap-loading-text {
    font-size: 18px;
    font-weight: 600;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s ease;
}

.igcap-loading-steps {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 24px;
}

.igcap-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.igcap-step svg {
    width: 16px;
    height: 16px;
}

.igcap-step-active {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
    animation: igcap-step-pulse 2s ease-in-out infinite;
}

@keyframes igcap-step-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(255, 255, 255, 0);
    }
}

.igcap-step-complete {
    background: rgba(16, 185, 129, 0.3);
    color: #ffffff;
    border-color: rgba(16, 185, 129, 0.5);
}

@media (max-width: 768px) {
    .igcap-loading-card {
        padding: 24px;
    }
    
    .igcap-loading-steps {
        flex-direction: column;
        gap: 12px;
    }
    
    .igcap-step {
        justify-content: center;
    }
}

/* Results */
.igcap-results {
    margin-top: 32px;
}

.igcap-results-title {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 24px 0;
}

/* Result Card */
.igcap-result-card {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
}

.igcap-result-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.igcap-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.igcap-result-label {
    font-size: 14px;
    font-weight: 600;
    color: #6366f1;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Copy Button */
.igcap-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    background: #f9fafb;
    color: #4b5563;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.igcap-copy-btn:hover {
    background: #6366f1;
    color: #ffffff;
    border-color: #6366f1;
}

.igcap-copy-btn svg {
    width: 16px;
    height: 16px;
}

.igcap-copy-btn.copied {
    background: #10b981;
    color: #ffffff;
    border-color: #10b981;
}

/* Result Content */
.igcap-result-content {
    font-size: 15px;
    line-height: 1.7;
    color: #374151;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Hashtags Grid */
.igcap-hashtags-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.igcap-hashtag {
    display: inline-block;
    padding: 6px 12px;
    background: #f3f4f6;
    color: #6366f1;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.igcap-hashtag:hover {
    background: #6366f1;
    color: #ffffff;
}

/* Messages */
.igcap-error,
.igcap-success {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 10px;
    margin-top: 20px;
    font-size: 14px;
    font-weight: 500;
}

.igcap-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.igcap-success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.igcap-error svg,
.igcap-success svg {
    flex-shrink: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .igcap-container {
        padding: 0 16px;
        margin: 24px auto;
    }
    
    .igcap-title {
        font-size: 24px;
    }
    
    .igcap-subtitle {
        font-size: 14px;
    }
    
    .igcap-form-wrapper {
        padding: 24px;
        border-radius: 12px;
    }
    
    .igcap-row {
        flex-direction: column;
        gap: 0;
    }
    
    .igcap-col-half {
        padding: 0;
    }
    
    .igcap-button-group {
        gap: 6px;
    }
    
    .igcap-option-btn {
        padding: 7px 12px;
        font-size: 13px;
    }
    
    .igcap-result-card {
        padding: 20px;
    }
    
    .igcap-result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .igcap-title {
        font-size: 20px;
    }
    
    .igcap-form-wrapper {
        padding: 20px;
    }
    
    .igcap-result-card {
        padding: 16px;
    }
}

/* Animation for results appearing */
@keyframes igcap-slide-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.igcap-results {
    animation: igcap-slide-in 0.4s ease-out;
}

.igcap-result-card {
    animation: igcap-slide-in 0.4s ease-out;
}

.igcap-result-card:nth-child(1) { animation-delay: 0.1s; }
.igcap-result-card:nth-child(2) { animation-delay: 0.2s; }
.igcap-result-card:nth-child(3) { animation-delay: 0.3s; }
.igcap-result-card:nth-child(4) { animation-delay: 0.4s; }
