* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    padding: 40px;
}

.input-section {
    margin-bottom: 40px;
}

.input-methods {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    align-items: center;
    margin-bottom: 30px;
}

.text-input-container {
    display: flex;
    flex-direction: column;
}

.text-input-container label {
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

#json-input {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.3s ease;
}

#json-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.or-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.or-divider span {
    background: white;
    padding: 0 20px;
    font-weight: 600;
    color: #666;
    border: 2px solid #e1e5e9;
    border-radius: 50px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drop-zone {
    border: 3px dashed #d1d5db;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f9fafb;
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drop-zone:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.drop-zone.drag-over {
    border-color: #667eea;
    background: #e0e7ff;
    border-style: solid;
    transform: scale(1.02);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: #667eea;
    margin-bottom: 10px;
}

.drop-zone p {
    color: #374151;
    font-weight: 500;
}

.file-info {
    color: #6b7280;
    font-size: 0.9rem;
}

.file-info button {
    color: #667eea;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    font-weight: 500;
}

.conversion-controls {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.control-buttons {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.model-name-input {
    flex: 1;
    min-width: 200px;
}

.model-name-input label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

#model-name {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

#model-name:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#convert-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

#convert-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

#convert-btn:active {
    transform: translateY(0);
}

#convert-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.clear-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.clear-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.3);
}

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

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

.progress-container {
    margin-top: 30px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    font-weight: 600;
    color: #667eea;
}

.output-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 40px;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 20px;
}

.output-buttons {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

#language-selector {
    padding: 8px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: border-color 0.3s ease;
    min-width: 120px;
}

#language-selector:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#language-selector:hover {
    border-color: #667eea;
}

.output-header h2 {
    color: #333;
    font-size: 1.8rem;
}

#download-btn {
    background: linear-gradient(135deg, #10b981 0%, #047857 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
}

#download-btn:active {
    transform: translateY(0);
}

#download-btn svg {
    width: 16px;
    height: 16px;
}

.code-preview {
    background: #1e1e2e;
    border-radius: 15px;
    padding: 20px;
    overflow-x: auto;
    position: relative;
}

.code-preview pre {
    margin: 0;
}

.code-preview code {
    color: #cdd6f4;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre;
}

/* Swift syntax highlighting */
.swift-keyword {
    color: #f38ba8; /* Pink for keywords */
    font-weight: 600;
}

.swift-type {
    color: #89b4fa; /* Blue for types */
    font-weight: 500;
}

.swift-property {
    color: #94e2d5; /* Teal for properties */
}

.swift-string {
    color: #a6e3a1; /* Green for strings */
}

.swift-comment {
    color: #6c7086; /* Gray for comments */
    font-style: italic;
}

.swift-punctuation {
    color: #cdd6f4; /* Default color for punctuation */
}

/* Copy to clipboard overlay button */
.copy-overlay-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(116, 199, 236, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(116, 199, 236, 0.2);
    color: #74c7ec;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    z-index: 10;
}

.copy-overlay-btn:hover {
    background: rgba(116, 199, 236, 0.2);
    border-color: rgba(116, 199, 236, 0.4);
    transform: scale(1.05);
}

.copy-overlay-btn:active {
    transform: scale(0.95);
}

.copy-overlay-btn svg {
    width: 18px;
    height: 18px;
}

.copy-overlay-btn.copied {
    background: rgba(166, 227, 161, 0.2);
    border-color: rgba(166, 227, 161, 0.4);
    color: #a6e3a1;
}

.copy-overlay-btn.copied svg {
    transform: scale(0.9);
}

/* Toast Notification */
.overlay-buttons {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    z-index: 100;
}

.copy-overlay-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    position: relative;
}

.copy-overlay-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

/* Tooltip styles */
.copy-overlay-btn::before {
    content: attr(title);
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.copy-overlay-btn::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-bottom-color: rgba(0, 0, 0, 0.8);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.copy-overlay-btn:hover::before,
.copy-overlay-btn:hover::after {
    opacity: 1;
}

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    background: #10b981;
    color: white;
    padding: 16px 24px;
    border-radius: 10px;
    font-weight: 600;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translate(-50%, -100px);
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
}

.toast.show {
    transform: translate(-50%, 0);
    opacity: 1;
}

.toast svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    stroke-width: 3;
    stroke: white;
    fill: none;
}

.toast span {
    font-size: 15px;
    font-weight: 600;
}

/* Google Ads Styling */
.ad-container {
    margin: 20px 0;
    text-align: center;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-banner {
    margin-bottom: 30px;
    border-radius: 8px;
    overflow: hidden;
}

.ad-bottom {
    margin-top: 30px;
    border-radius: 8px;
    overflow: hidden;
}

/* Responsive design */
@media (max-width: 768px) {
    .input-methods {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .or-divider {
        transform: rotate(90deg);
    }

    .conversion-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .output-header {
        flex-direction: column;
        align-items: stretch;
    }

    header {
        padding: 30px 20px;
    }

    header h1 {
        font-size: 2rem;
    }

    main {
        padding: 30px 20px;
    }
}

/* Animation for successful file drop */
@keyframes dropSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.drop-zone.success {
    animation: dropSuccess 0.3s ease;
    border-color: #10b981;
    background: #ecfdf5;
}

/* Loading animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Syntax highlighting styles */
.keyword {
    color: #cf222e;
    font-weight: 600;
}

.type {
    color: #0969da;
    font-weight: 500;
}

.string {
    color: #0a3069;
    background-color: #ddf4ff;
    padding: 1px 2px;
    border-radius: 2px;
}

.comment {
    color: #656d76;
    font-style: italic;
}

.attribute {
    color: #8250df;
    font-weight: 500;
}

/* Multiple model containers */
.model-container {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.model-container .code-preview {
    position: relative;
    margin-top: 20px;
    border-radius: 10px;
    overflow: hidden;
    background: #f8fafc;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.model-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.model-header {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.model-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #374151;
}

.model-actions {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 10px;
    z-index: 10;
}

.overlay-buttons {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    gap: 8px;
    z-index: 10;
    height: 40px;
    line-height: 0;
}

/* Force exact button alignment - remove all spacing */
#copy-btn,
#clear-code-btn,
#download-code-btn {
    all: unset !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    outline: 0 !important;
    border-radius: 8px !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    position: relative !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    flex-basis: 40px !important;
    box-sizing: border-box !important;
    vertical-align: top !important;
    line-height: 0 !important;
    font-size: 0 !important;
}

#copy-btn svg,
#clear-code-btn svg,
#download-code-btn svg {
    width: 18px !important;
    height: 18px !important;
    stroke: white !important;
    stroke-width: 2 !important;
    fill: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    outline: 0 !important;
    display: block !important;
}

/* Enhanced Tooltips */
#copy-btn::after,
#clear-code-btn::after,
#download-code-btn::after {
    content: attr(title);
    position: absolute;
    bottom: -35px;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1000;
}

#copy-btn::before,
#clear-code-btn::before,
#download-code-btn::before {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 15px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid rgba(0, 0, 0, 0.9);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1000;
}

#copy-btn:hover::after,
#clear-code-btn:hover::after,
#download-code-btn:hover::after {
    opacity: 1;
    transform: translateY(-2px);
}

#copy-btn:hover::before,
#clear-code-btn:hover::before,
#download-code-btn:hover::before {
    opacity: 1;
    transform: translateY(-2px);
}

/* Color overrides */
#clear-code-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
}

#download-code-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
}

/* Hover effects */
#copy-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4) !important;
}

#clear-code-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4) !important;
}

#download-code-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4) !important;
}

.download-model-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.copy-model-btn, .download-model-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-width: 40px;
    height: 40px;
}

.download-model-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.copy-model-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.download-model-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.copy-model-btn svg, .download-model-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

#download-all-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

#download-selector-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.model-container pre {
    margin: 0;
    padding: 20px;
    background: #f8fafc;
    overflow-x: auto;
}

.model-container code {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
}

/* Language Selector Styling */
#language-selector {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: var(--surface-color);
    border: 3px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    padding: 12px 40px 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

#language-selector:hover {
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

#language-selector:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#language-selector option {
    background: var(--surface-color);
    color: var(--text-color);
    padding: 12px 16px;
    font-weight: 500;
}

/* Dark mode adjustments for language selector */
@media (prefers-color-scheme: dark) {
    #language-selector {
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    }
}
