/* URL Shortener - Global Styles */
:root {
    --primary-color: #FF7A00;
    --primary-dark: #E56A00;
    --secondary-color: #0066CC;
    --success-color: #22C55E;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --bg-tertiary: #F3F4F6;
    --border-color: #E5E7EB;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 40px 20px;
}

.header-content h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header-content .tagline {
    font-size: 1.2rem;
    opacity: 0.95;
}

/* Main Content */
.main-content {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
}

section {
    margin-bottom: 50px;
}

section h2 {
    font-size: 1.8rem;
    margin-bottom: 25px;
    color: var(--text-primary);
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 10px;
    display: inline-block;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.url-input,
.alias-input,
.search-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
}

.url-input:focus,
.alias-input:focus,
.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.1);
}

.help-text {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
    justify-content: center;
    margin-top: 10px;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary {
    background: var(--secondary-color);
    color: white;
    width: 100%;
    justify-content: center;
}

.btn-secondary:hover {
    background: #0052A3;
    transform: translateY(-2px);
}

.btn-copy {
    background: var(--secondary-color);
    color: white;
    padding: 10px 16px;
    font-size: 0.9rem;
}

.btn-copy:hover {
    background: #0052A3;
}

.btn-small {
    padding: 8px 12px;
    font-size: 0.85rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-small:hover {
    background: var(--border-color);
}

/* Error Message */
.error-message {
    display: none;
    background: #FEE2E2;
    color: #DC2626;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 10px;
    border-left: 4px solid #DC2626;
}

.error-message.show {
    display: block;
    animation: slideIn 0.3s ease;
}

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

/* Input Section */
.input-section {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 40px;
}

/* Results Section */
.results-section {
    background: #FFFBEB;
    border-left: 4px solid var(--warning-color);
    padding: 30px;
    border-radius: 12px;
    animation: slideIn 0.3s ease;
}

.result-card {
    background: white;
    padding: 25px;
    border-radius: 8px;
    margin-top: 20px;
}

.result-item {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.result-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.result-item label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.original-url {
    word-break: break-all;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    background: var(--bg-tertiary);
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.short-link-container {
    display: flex;
    gap: 10px;
}

.short-link-display {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--primary-color);
}

.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.qr-code {
    width: 200px;
    height: 200px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    background: white;
}

.created-time {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.click-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* URLs List Section */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 25px;
}

.section-controls {
    display: flex;
    gap: 10px;
    flex: 1;
    min-width: 250px;
}

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

.urls-list {
    display: grid;
    gap: 15px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-radius: 8px;
}

.url-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    transition: var(--transition);
    flex-wrap: wrap;
}

.url-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.url-item-left {
    flex: 1;
    min-width: 200px;
}

.url-item-code {
    font-weight: 700;
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
    margin-bottom: 5px;
}

.url-item-original {
    font-size: 0.9rem;
    color: var(--text-secondary);
    word-break: break-all;
    margin-bottom: 5px;
}

.url-item-stats {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.url-item-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.url-item-actions button {
    padding: 8px 12px;
    font-size: 0.85rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.url-item-actions button:hover {
    background: var(--border-color);
}

/* Stats Section */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 25px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 0.95rem;
    opacity: 0.95;
}

/* Footer */
.footer {
    text-align: center;
    color: white;
    padding: 30px 20px;
    font-size: 0.9rem;
}

.footer p {
    margin: 5px 0;
}

.footer-note {
    opacity: 0.8;
    font-size: 0.8rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content h1 {
        font-size: 2rem;
    }

    .main-content {
        padding: 20px;
    }

    section h2 {
        font-size: 1.5rem;
    }

    .section-header {
        flex-direction: column;
    }

    .section-controls {
        flex-direction: column;
        width: 100%;
    }

    .search-input {
        min-width: 100%;
    }

    .url-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .url-item-actions {
        width: 100%;
        flex-direction: column;
    }

    .url-item-actions button {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .short-link-container {
        flex-direction: column;
    }

    .btn-copy {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .header-content h1 {
        font-size: 1.5rem;
    }

    .main-content {
        padding: 15px;
    }

    section {
        margin-bottom: 30px;
    }

    section h2 {
        font-size: 1.3rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .url-item {
        padding: 15px;
    }

    .qr-code {
        width: 150px;
        height: 150px;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.success-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--success-color);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    z-index: 1000;
}

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

.success-toast.hiding {
    animation: fadeOut 0.3s ease;
}
