/* Modern CSS Variables */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-border: rgba(255, 255, 255, 0.2);
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.15);
    --border-radius: 16px;
    --border-radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #667eea 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow-x: hidden;
    color: var(--text-primary);
    line-height: 1.6;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Animated Background Particles */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 40% 80%, rgba(255, 255, 255, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 90% 20%, rgba(255, 255, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 10% 90%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    animation: floatParticles 25s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 60% 40%, rgba(118, 75, 162, 0.1) 0%, transparent 60%),
        radial-gradient(circle at 30% 70%, rgba(102, 126, 234, 0.08) 0%, transparent 50%);
    animation: floatParticles 30s ease-in-out infinite reverse;
    pointer-events: none;
    z-index: -1;
}

@keyframes floatParticles {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }

    25% {
        transform: translate(20px, -15px) rotate(90deg) scale(1.1);
    }

    50% {
        transform: translate(-15px, 20px) rotate(180deg) scale(0.9);
    }

    75% {
        transform: translate(25px, 10px) rotate(270deg) scale(1.05);
    }
}

/* Navbar Styling */
.navbar {
    background: linear-gradient(135deg,
            rgba(102, 126, 234, 0.95) 0%,
            rgba(118, 75, 162, 0.9) 50%,
            rgba(102, 126, 234, 0.95) 100%) !important;
    backdrop-filter: blur(30px);
    border-bottom: none;
    box-shadow:
        0 10px 40px rgba(102, 126, 234, 0.3),
        0 5px 20px rgba(118, 75, 162, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    padding: 1.5rem 0;
}

.navbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    animation: navShimmer 4s ease-in-out infinite;
}

.navbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.8) 50%,
            rgba(255, 255, 255, 0) 100%);
    animation: borderGlow 3s ease-in-out infinite;
}

@keyframes navShimmer {
    0% {
        left: -100%;
    }

    50% {
        left: 100%;
    }

    100% {
        left: 100%;
    }
}

@keyframes borderGlow {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

.navbar-brand {
    font-weight: 900;
    font-size: 2rem;
    background: linear-gradient(45deg, #ffffff, #f8f9ff, #ffffff);
    background-size: 200% 200%;
    animation: gradientText 3s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    text-shadow:
        0 0 20px rgba(255, 255, 255, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

@keyframes gradientText {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.navbar-brand:hover {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

/* Navbar Brand Container */
.navbar-brand-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
}

.navbar-brand-container::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -15px;
    right: -15px;
    bottom: -10px;
    background: linear-gradient(45deg,
            rgba(255, 255, 255, 0.1) 0%,
            rgba(255, 255, 255, 0.05) 50%,
            rgba(255, 255, 255, 0.1) 100%);
    border-radius: 20px;
    opacity: 0;
    transition: var(--transition);
    z-index: -1;
}

.navbar-brand-container:hover::before {
    opacity: 1;
}

.powered-by {
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    margin-top: -0.3rem;
    margin-left: 2px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    transition: var(--transition);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.9), rgba(248, 249, 255, 0.7));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.powered-by:hover {
    background: linear-gradient(45deg, rgba(255, 255, 255, 1), rgba(248, 249, 255, 0.9));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transform: translateY(-1px);
}

/* Card Styling */
.card {
    border: none;
    border-radius: var(--border-radius-lg);
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    overflow: hidden;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: var(--transition);
}

.card:hover::before {
    opacity: 1;
}

.card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: var(--shadow-lg);
}

.card-header {
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0 !important;
    border: none;
    background: var(--primary-gradient) !important;
    color: white !important;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.card-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 200%;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(45deg);
    transition: var(--transition);
    opacity: 0;
}

.card-header:hover::before {
    opacity: 1;
    animation: shimmer 1.5s ease-in-out;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) rotate(45deg);
    }

    100% {
        transform: translateX(100%) rotate(45deg);
    }
}

.card-body {
    padding: 2rem;
}

/* Button Styling */
.btn {
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: var(--transition);
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(145deg, #667eea, #764ba2);
    box-shadow:
        0 8px 25px rgba(102, 126, 234, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow:
        0 15px 35px rgba(102, 126, 234, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    background: linear-gradient(145deg, #7c8ef7, #8a5fc7);
}

.btn-success {
    background: linear-gradient(145deg, #4facfe, #00f2fe);
    box-shadow:
        0 8px 25px rgba(79, 172, 254, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-success:hover {
    transform: translateY(-3px);
    box-shadow:
        0 15px 35px rgba(79, 172, 254, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    background: linear-gradient(145deg, #6bb6ff, #26f4fe);
}

.btn-outline-success {
    border: 2px solid #4facfe;
    color: #4facfe;
    background: transparent;
}

.btn-outline-success:hover {
    background: var(--success-gradient);
    border-color: transparent;
    color: white;
    transform: translateY(-2px);
}

.btn-outline-primary {
    border: 2px solid #667eea;
    color: #667eea;
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
}

/* Form Styling */
.form-control,
.form-select {
    border-radius: var(--border-radius);
    border: 2px solid rgba(233, 236, 239, 0.3);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.8));
    backdrop-filter: blur(10px);
    transition: var(--transition);
    padding: 0.875rem 1rem;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.form-control:focus,
.form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.15);
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

/* Image Styling */
#generatedImage {
    border-radius: var(--border-radius);
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

#generatedImage:hover {
    transform: scale(1.03);
    box-shadow: var(--shadow-lg);
}

/* Alert Styling */
.alert {
    border-radius: var(--border-radius);
    border: none;
    background: rgba(255, 255, 255, 1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Loading Animation */
.spinner-border {
    width: 3rem;
    height: 3rem;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Button Group Styling */
.btn-group .btn-check:checked+.btn {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
}

/* Container Animations */
.container {
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-gradient);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-gradient);
}

/* Tooltip Styling */
.tooltip {
    font-size: 0.875rem;
}

.tooltip-inner {
    background: linear-gradient(145deg, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.8));
    backdrop-filter: blur(10px);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    padding: 0.5rem 0.75rem;
}

.tooltip .tooltip-arrow::before {
    border-top-color: rgba(0, 0, 0, 0.9);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .card {
        margin-bottom: 1.5rem;
    }

    .card-body {
        padding: 1.5rem;
    }

    .navbar-brand {
        font-size: 1.5rem;
    }

    .row .col-md-4 {
        margin-bottom: 1rem;
    }
}

@media (max-width: 576px) {
    .card-body {
        padding: 1rem;
    }

    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }
}

/* Focus States for Accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Glass morphism effect for modals and overlays */
.modal-content {
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Micro-interactions */
.card,
.btn,
.form-control,
.form-select {
    will-change: transform;
}

/* Loading state improvements */
#imageLoading,
#textLoading {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }

    100% {
        opacity: 1;
    }
}

/* Tab Navigation Styling */
.nav-tabs {
    border: none;
    margin-bottom: 2rem;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius-lg);
    padding: 0.75rem;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-tabs .nav-link {
    border: none;
    border-radius: var(--border-radius);
    margin: 0 0.25rem;
    padding: 1rem 2rem;
    font-weight: 600;
    transition: var(--transition);
    color: rgba(255, 255, 255, 0.7);
    background: transparent;
    position: relative;
    overflow: hidden;
}

.nav-tabs .nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: var(--transition);
}

.nav-tabs .nav-link:hover::before {
    left: 100%;
}

.nav-tabs .nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.nav-tabs .nav-link.active {
    color: white;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.15));
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-3px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.tab-content {
    position: relative;
}

.tab-pane {
    animation: fadeInUp 0.5s ease-out;
}

/* Custom Select Styling */
.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23667eea' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    appearance: none;
    cursor: pointer;
    padding-right: 2.5rem;
}

.form-select:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

/* Tab icons */
.nav-link i {
    margin-right: 0.5rem;
    font-size: 1.1rem;
}

/* Single card container for tabs */
.main-card {
    border: none;
    border-radius: var(--border-radius-lg);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
    backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.1),
        0 8px 25px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    transition: var(--transition);
    overflow: hidden;
    position: relative;
}

.main-card:hover {
    transform: translateY(-8px);
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.15),
        0 12px 30px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.main-card .card-body {
    padding: 2rem;
}

/* Enhanced Input Focus Effects */
.form-control:focus,
.form-select:focus {
    border-color: #667eea;
    box-shadow:
        0 0 0 0.2rem rgba(102, 126, 234, 0.15),
        0 8px 25px rgba(102, 126, 234, 0.1);
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
}

/* Loading Spinner Enhancements */
.spinner-border {
    background: conic-gradient(from 0deg, transparent, #667eea, transparent);
    border: none;
    border-radius: 50%;
    mask: radial-gradient(circle at center, transparent 45%, black 46%);
    -webkit-mask: radial-gradient(circle at center, transparent 45%, black 46%);
}

/* Floating Label Effects */
.form-label {
    position: relative;
    display: inline-block;
}

.form-label::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    transition: width 0.3s ease;
}

.form-control:focus+.form-label::after,
.form-select:focus+.form-label::after {
    width: 100%;
}

/* Success/Error States */
.btn:active {
    transform: translateY(0) scale(0.98);
}

/* Advanced Gradient Animations */
@keyframes btnGlow {

    0%,
    100% {
        box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    }

    50% {
        box-shadow: 0 12px 35px rgba(102, 126, 234, 0.6);
    }
}

.btn-primary:hover {
    animation: btnGlow 2s ease-in-out infinite;
}

/* Texture Overlay */
.main-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23667eea' fill-opacity='0.02'%3E%3Ccircle cx='7' cy='7' r='1'/%3E%3Ccircle cx='53' cy='7' r='1'/%3E%3Ccircle cx='7' cy='53' r='1'/%3E%3Ccircle cx='53' cy='53' r='1'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
    opacity: 0.3;
}
