/* Design System & Variables */
:root {
    --bg-dark: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.7);
    --border-color: rgba(0, 0, 0, 0.08);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --primary-color: #7c3aed; /* Violet */
    --secondary-color: #0891b2; /* Cyan */
    --accent-color: #2563eb; /* Blue */
    --success-color: #059669; /* Emerald */
    --error-color: #dc2626; /* Red */
    --glass-blur: blur(16px);
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Basic Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    padding-bottom: 60px;
    line-height: 1.5;
}

/* Decorative Background Glows */
.glow-bg {
    display: none;
}

/* Container */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 30px 20px;
}

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

::-webkit-scrollbar-track {
    background: rgba(240, 240, 245, 0.5);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Typography */
h1, h2, h3, h4 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

/* Glassmorphism Class */
.glass-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

/* Header */
.app-header {
    margin-bottom: 30px;
    text-align: center;
}

.logo-area {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    text-align: left;
}

.logo-icon {
    font-size: 2.8rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 15px rgba(124, 58, 237, 0.15));
    animation: pulse-logo 3s ease-in-out infinite;
}

.logo-area h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo-area h1 span {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 4px;
    font-weight: 400;
}

@keyframes pulse-logo {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Input Section */
.input-section {
    padding: 30px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.input-section::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.02), transparent);
    transform: translateX(-100%);
    animation: shimmer 8s infinite linear;
    pointer-events: none;
}

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

.input-group {
    display: flex;
    gap: 15px;
    width: 100%;
}

.input-wrapper {
    position: relative;
    flex-grow: 1;
}

.input-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.1rem;
    transition: var(--transition-fast);
}

.input-wrapper input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: var(--transition-normal);
}

.input-wrapper input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(124, 58, 237, 0.15);
    background: #ffffff;
}

.input-wrapper input:focus + .input-icon {
    color: var(--primary-color);
}

/* Buttons */
button {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    cursor: pointer;
    border: none;
    outline: none;
    transition: var(--transition-fast);
}

#submit-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 0 32px;
    border-radius: 12px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
    white-space: nowrap;
}

#submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5);
    filter: brightness(1.1);
}

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

.input-info {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.info-tag {
    display: flex;
    align-items: center;
    gap: 6px;
}

.info-tag i {
    color: var(--secondary-color);
}

/* Error Card */
.error-card {
    background: #fef2f2;
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.error-icon {
    font-size: 1.5rem;
    color: var(--error-color);
    padding-top: 2px;
}

.error-content h3 {
    color: #ff6b6b;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.error-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Controls Card */
.controls-card {
    padding: 24px;
    margin-bottom: 30px;
}

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

.chat-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    background-color: var(--success-color);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success-color);
}

#chat-name {
    font-size: 1.4rem;
    font-weight: 700;
}

.chat-link-display {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 4px;
    word-break: break-all;
}

.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.search-wrapper {
    position: relative;
    flex-grow: 1;
    max-width: 450px;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.search-wrapper input {
    width: 100%;
    padding: 12px 40px 12px 40px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-normal);
}

.search-wrapper input:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.1);
}

.clear-search {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
}

.clear-search:hover {
    color: var(--text-primary);
}

.actions-group {
    display: flex;
    align-items: center;
    gap: 20px;
}

.stats-badge {
    background: rgba(0, 0, 0, 0.03);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.stats-badge span {
    color: var(--text-primary);
    font-weight: 600;
}

.btn-group {
    display: flex;
    gap: 8px;
}

.btn-secondary {
    background: #ffffff;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

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

/* Grid Layout */
.smileys-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

/* Smiley Card */
.smiley-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.smiley-card:hover {
    border-color: var(--primary-color);
}

/* Checkerboard transparent background for images */
.smiley-preview {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-color: #f8fafc;
    background-image: 
        linear-gradient(45deg, #f1f5f9 25%, transparent 25%), 
        linear-gradient(-45deg, #f1f5f9 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #f1f5f9 75%), 
        linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    padding: 12px;
}

.smiley-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.size-tag {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(255, 255, 255, 0.85);
    color: var(--text-primary);
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.smiley-details {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0, 0, 0, 0.02);
    border-top: 1px solid var(--border-color);
    flex-grow: 1;
}

.smiley-code-btn {
    width: 100%;
    padding: 8px;
    background: rgba(0, 0, 0, 0.02);
    border: 1px dashed rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.8rem;
    text-align: center;
    word-break: break-all;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.smiley-code-btn:hover {
    background: rgba(124, 58, 237, 0.08);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.smiley-actions {
    display: flex;
    gap: 6px;
}

.action-btn {
    flex-grow: 1;
    padding: 6px;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: var(--transition-fast);
}

.action-btn:hover {
    background: rgba(6, 182, 212, 0.08);
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

/* Welcome Panel */
.welcome-panel {
    padding: 60px 20px;
    text-align: center;
}

.welcome-content {
    max-width: 500px;
    margin: 0 auto;
}

.welcome-icon {
    font-size: 3.5rem;
    color: rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.welcome-content h2 {
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.welcome-content p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 24px;
}

.demo-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.demo-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.demo-link-btn {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    color: var(--secondary-color);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.demo-link-btn:hover {
    background: rgba(6, 182, 212, 0.08);
    border-color: var(--secondary-color);
}

/* Empty search state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Skeleton Loading Animation */
.skeleton-header-card {
    padding: 24px;
    margin-bottom: 30px;
    height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
}

.skeleton-line {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-title {
    width: 200px;
    height: 20px;
}

.skeleton-subtitle {
    width: 350px;
    height: 14px;
}

.skeleton-card {
    height: 195px;
    background: linear-gradient(90deg, #f1f5f9 25%, #f8fafc 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Toast System */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    padding: 14px 20px;
    color: var(--text-primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 250px;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast i {
    font-size: 1.1rem;
}

.toast-success {
    border-left-color: var(--success-color);
}

.toast-success i {
    color: var(--success-color);
}

.toast-info {
    border-left-color: var(--secondary-color);
}

.toast-info i {
    color: var(--secondary-color);
}

/* Helper Class */
.hidden {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 15px 10px;
    }
    .input-group {
        flex-direction: column;
    }
    #submit-btn {
        padding: 16px;
        justify-content: center;
    }
    .controls-row {
        flex-direction: column;
        align-items: stretch;
    }
    .search-wrapper {
        max-width: 100%;
    }
    .actions-group {
        justify-content: space-between;
    }
    .toast-container {
        left: 20px;
        right: 20px;
        bottom: 20px;
    }
    .toast {
        min-width: 100%;
    }
}

/* Pagination Styling */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 35px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.page-btn {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-fast);
}

.page-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.02);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.page-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 10px rgba(124, 58, 237, 0.2);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-btn.nav-btn {
    width: auto;
    padding: 0 16px;
    gap: 6px;
}

/* Page Size Selector Styling */
.page-size-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.page-size-select {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    transition: var(--transition-fast);
}

.page-size-select:focus {
    border-color: var(--primary-color);
}
