/**
 * UTM Builder Tool - Modern CSS Styling
 * Advanced styling for comprehensive UTM parameter generation tool
 * Features: Responsive design, animations, interactive elements, campaign cards
 */

/* Container and Layout */
.utm-builder-container {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Quick Actions Styling */
.quick-action {
    position: relative;
    overflow: hidden;
}

.quick-action::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.quick-action:hover::before {
    left: 100%;
}

/* Form Input Enhancements */
input[type="text"],
input[type="url"],
textarea {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input[type="text"]:focus,
input[type="url"]:focus,
textarea:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

/* URL Validation Styling */
#urlValidation.valid {
    color: #10b981;
    background-color: #ecfdf5;
    border: 1px solid #d1fae5;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#urlValidation.invalid {
    color: #ef4444;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#urlValidation.valid::before {
    content: "✓";
    font-weight: bold;
}

#urlValidation.invalid::before {
    content: "✗";
    font-weight: bold;
}

/* Suggestion Dropdown Styling */
.suggestion-list {
    position: relative;
    z-index: 10;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
}

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f3f4f6;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background-color: #f8fafc;
}

.suggestion-item.selected {
    background-color: #eff6ff;
    color: #2563eb;
}

.suggestion-category {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    font-weight: 600;
    padding: 0.5rem 1rem;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    letter-spacing: 0.05em;
}

/* Parameter Preview Animations */
.parameter-preview-item {
    transition: all 0.3s ease;
}

.parameter-preview-item.updated {
    background-color: #dbeafe;
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.parameter-preview-item.updated::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid #3b82f6;
    border-radius: inherit;
    opacity: 0.5;
    animation: preview-flash 0.6s ease-out;
}

@keyframes preview-flash {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
    }
    100% {
        opacity: 0;
        transform: scale(1);
    }
}

/* UTM URL Output Styling */
#utmUrlOutput {
    font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
    line-height: 1.5;
    word-break: break-all;
}

#utmUrlOutput:focus {
    background-color: #f0f9ff;
}

/* Copy Button Animation */
.copy-success {
    animation: copy-success-pulse 0.6s ease-out;
}

@keyframes copy-success-pulse {
    0% {
        transform: scale(1);
        background-color: #3b82f6;
    }
    50% {
        transform: scale(1.1);
        background-color: #10b981;
    }
    100% {
        transform: scale(1);
        background-color: #10b981;
    }
}

/* QR Code Section */
#qrCodeDisplay img {
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

#qrCodeDisplay img:hover {
    transform: scale(1.05);
}

/* Analysis Section */
.analysis-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.analysis-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

.analysis-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.analysis-metric:last-child {
    border-bottom: none;
}

.analysis-metric-label {
    font-weight: 600;
    color: #374151;
}

.analysis-metric-value {
    font-weight: 700;
    color: #1f2937;
}

.quality-score {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.875rem;
}

.quality-score.excellent {
    background-color: #dcfce7;
    color: #15803d;
}

.quality-score.good {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.quality-score.fair {
    background-color: #fef3c7;
    color: #d97706;
}

.quality-score.poor {
    background-color: #fecaca;
    color: #dc2626;
}

/* Bulk Builder Styling */
#bulkCampaignData {
    font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
    background-color: #f8fafc;
    transition: all 0.3s ease;
}

#bulkCampaignData:focus {
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.bulk-result-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
}

.bulk-result-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.bulk-result-item.success {
    border-left: 4px solid #10b981;
    background-color: #f0fdf4;
}

.bulk-result-item.error {
    border-left: 4px solid #ef4444;
    background-color: #fef2f2;
}

.bulk-result-url {
    font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
    font-size: 0.875rem;
    background-color: #f3f4f6;
    padding: 0.5rem;
    border-radius: 0.375rem;
    word-break: break-all;
    margin-top: 0.5rem;
}

/* Statistics Cards */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #06b6d4);
    transform: translateX(-100%);
    animation: stat-card-loading 2s ease-in-out infinite;
}

@keyframes stat-card-loading {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Toast Notifications */
.toast-success {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    border: 1px solid #86efac;
    color: #15803d;
}

.toast-error {
    background: linear-gradient(135deg, #fef2f2, #fecaca);
    border: 1px solid #fca5a5;
    color: #dc2626;
}

.toast-warning {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #f59e0b;
    color: #d97706;
}

.toast-info {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border: 1px solid #93c5fd;
    color: #1d4ed8;
}

.toast.show {
    transform: translateX(0);
}

/* Processing Status Animation */
#processingStatus {
    animation: processing-slide-in 0.3s ease-out;
}

@keyframes processing-slide-in {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Button Hover Effects */
button:not(:disabled) {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

button:not(:disabled):hover {
    transform: translateY(-1px);
}

button:not(:disabled):active {
    transform: translateY(0);
}

/* Loading State */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: button-spin 0.8s linear infinite;
}

@keyframes button-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Checkbox Styling */
input[type="checkbox"] {
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #d1d5db;
    border-radius: 0.25rem;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

input[type="checkbox"]:checked {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    top: 1px;
    left: 4px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Drag and Drop Styling */
.drag-over {
    border: 2px dashed #3b82f6;
    background-color: #eff6ff;
}

/* URL Length Indicator */
.url-length-indicator {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.url-length-short {
    background-color: #dcfce7;
    color: #15803d;
}

.url-length-medium {
    background-color: #fef3c7;
    color: #d97706;
}

.url-length-long {
    background-color: #fecaca;
    color: #dc2626;
}

/* Campaign Templates Grid */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.template-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.template-card:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.15);
}

.template-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.template-card:hover::before {
    transform: scaleX(1);
}

.template-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.template-title {
    font-weight: 700;
    font-size: 1.125rem;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.template-description {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
}

/* Responsive Design */
@media (max-width: 768px) {
    .utm-builder-container {
        padding: 1rem;
    }

    .quick-action {
        padding: 0.75rem;
    }

    .quick-action span:last-child {
        font-size: 0.625rem;
    }

    .template-grid {
        grid-template-columns: 1fr;
    }

    #bulkCampaignData {
        font-size: 0.75rem;
    }

    .bulk-result-url {
        font-size: 0.75rem;
    }

    input[type="text"],
    input[type="url"],
    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

@media (max-width: 640px) {
    .grid {
        grid-template-columns: 1fr !important;
    }

    .flex-wrap {
        flex-direction: column;
    }

    .flex-wrap > * {
        width: 100%;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    /* Note: Keeping light theme as requested, but structure for dark mode if needed */
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .quick-action {
        border: 2px solid;
    }

    input[type="text"],
    input[type="url"],
    textarea {
        border: 2px solid #374151;
    }

    button {
        border: 2px solid;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .quick-action::before {
        display: none;
    }
}

/* Print Styles */
@media print {
    .utm-builder-container {
        background: white;
        color: black;
    }

    .quick-action,
    button,
    #processingStatus,
    #toast {
        display: none;
    }

    .bg-white {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* Accessibility Enhancements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus Indicators */
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Animation Performance */
* {
    will-change: auto;
}

.quick-action,
.parameter-preview-item,
.bulk-result-item {
    will-change: transform;
}

/* Scrollbar Styling */
.suggestion-list::-webkit-scrollbar,
#bulkResults::-webkit-scrollbar {
    width: 6px;
}

.suggestion-list::-webkit-scrollbar-track,
#bulkResults::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.suggestion-list::-webkit-scrollbar-thumb,
#bulkResults::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.suggestion-list::-webkit-scrollbar-thumb:hover,
#bulkResults::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}
