/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #1f2937;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}

.title {
    font-size: 3rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.subtitle {
    font-size: 1.125rem;
    color: #64748b;
    font-weight: 400;
}

.info-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid #d1d5db;
    background: white;
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #374151;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    max-width: 500px;
    margin: 1rem;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 24px;
    cursor: pointer;
    color: #9ca3af;
    transition: color 0.2s;
}

.close:hover {
    color: #374151;
}

.modal-content h3 {
    margin-bottom: 1rem;
    color: #1e293b;
}

.modal-content ul {
    margin: 1rem 0 1rem 1.5rem;
}

.modal-content li {
    margin-bottom: 0.5rem;
    color: #64748b;
}

.fine-print {
    font-size: 0.875rem;
    color: #9ca3af;
    margin-top: 1rem;
    font-style: italic;
}

/* Main content */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.input-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #f1f5f9;
}

.input-wrapper {
    margin-bottom: 1.5rem;
}

#urlInput {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.2s;
    background: #fafafa;
    font-family: inherit;
}

#urlInput:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#urlInput::placeholder {
    color: #9ca3af;
}

.input-error {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    min-height: 1.25rem;
}

.lengthen-btn {
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

.lengthen-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.4);
}

.lengthen-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-loading {
    display: none;
}

.lengthen-btn.loading .btn-text {
    display: none;
}

.lengthen-btn.loading .btn-loading {
    display: inline;
}

.rate-limit-info {
    text-align: center;
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 1rem;
    min-height: 1.25rem;
}

/* Results section */
.results-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #f1f5f9;
    display: none;
}

.results-section.show {
    display: block;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-item {
    margin-bottom: 1.5rem;
}

.result-label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.length-badge {
    background: #10b981;
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.url-display {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    word-break: break-all;
    line-height: 1.5;
    position: relative;
}

.url-display.original {
    color: #64748b;
}

.url-display.lengthened {
    color: #1e293b;
    background: #fef3c7;
    border-color: #fcd34d;
    padding-right: 3rem;
    max-height: 200px;
    overflow-y: auto;
}

.copy-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-btn:hover {
    background: #1d4ed8;
    transform: scale(1.05);
}

.copy-btn.success {
    background: #10b981;
}

.copy-feedback {
    text-align: right;
    font-size: 0.75rem;
    color: #10b981;
    margin-top: 0.25rem;
    min-height: 1rem;
}

/* Statistics */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
}

/* Fun fact */
.fun-fact {
    background: linear-gradient(135deg, #ede9fe 0%, #f3e8ff 100%);
    border: 1px solid #d8b4fe;
    border-radius: 12px;
    padding: 1.5rem;
    font-style: italic;
    color: #581c87;
    text-align: center;
    font-size: 1rem;
    line-height: 1.6;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 0.875rem;
}

.footer a {
    color: #3b82f6;
    text-decoration: none;
    transition: color 0.2s;
}

.footer a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Responsive design */
@media (max-width: 640px) {
    .container {
        padding: 1rem 0.75rem;
    }

    .title {
        font-size: 2.25rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .input-section,
    .results-section {
        padding: 1.5rem;
    }

    .info-btn {
        position: static;
        margin-top: 1rem;
    }

    .stats-section {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .modal-content {
        margin: 0.5rem;
        padding: 1.5rem;
    }
}

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

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