/* ============================================
   RESET & BASE STYLES
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #3b82f6;
    --primary-dark: #1e40af;
    --primary-bg: #eff6ff;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: #fee2e2;
    --success: #10b981;
    --success-light: #d1fae5;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.8);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --glass-blur: blur(20px);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 25%, #e0e7ff 50%, #dbeafe 75%, #eff6ff 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* ============================================
   BACKGROUND ANIMATIONS
   ============================================ */
.background-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.15;
    filter: blur(80px);
    animation: float 20s infinite ease-in-out;
}

.shape-1 {
    width: 500px;
    height: 500px;
    background: var(--primary);
    top: -10%;
    left: -10%;
    animation-delay: 0s;
}

.shape-2 {
    width: 400px;
    height: 400px;
    background: #7c3aed;
    bottom: -10%;
    right: -5%;
    animation-delay: -5s;
    animation-duration: 25s;
}

.shape-3 {
    width: 350px;
    height: 350px;
    background: #06b6d4;
    top: 50%;
    left: 60%;
    animation-delay: -10s;
    animation-duration: 22s;
}

.shape-4 {
    width: 300px;
    height: 300px;
    background: var(--primary);
    top: 70%;
    left: 20%;
    animation-delay: -15s;
    animation-duration: 18s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) translateX(0) scale(1);
    }
    25% {
        transform: translateY(-30px) translateX(20px) scale(1.05);
    }
    50% {
        transform: translateY(10px) translateX(-15px) scale(0.95);
    }
    75% {
        transform: translateY(-20px) translateX(-25px) scale(1.02);
    }
}

/* ============================================
   CONTAINER & LAYOUT
   ============================================ */
.container {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    text-align: center;
    padding: 30px 20px 20px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    color: var(--primary);
}

.logo-text {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.header-tagline {
    font-size: 0.9rem;
    color: var(--gray-500);
    font-weight: 400;
}

/* ============================================
   GLASS CARD
   ============================================ */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--glass-shadow);
    overflow: hidden;
    transition: box-shadow var(--transition-smooth);
}

.glass-card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

/* ============================================
   CREATOR CARD
   ============================================ */
.creator-card {
    margin-bottom: 20px;
}

.textarea-container {
    position: relative;
}

#pasteTextarea {
    width: 100%;
    min-height: 350px;
    padding: 24px;
    border: none;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--gray-800);
    background: rgba(249, 250, 251, 0.8);
    resize: vertical;
    transition: all var(--transition-smooth);
    outline: none;
}

#pasteTextarea::placeholder {
    color: var(--gray-400);
    font-family: var(--font-sans);
}

#pasteTextarea:focus {
    background: rgba(249, 250, 251, 0.95);
    box-shadow: inset 0 0 0 2px var(--primary-light);
}

.textarea-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: rgba(249, 250, 251, 0.5);
    border-top: 1px solid var(--gray-200);
}

.char-counter {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-family: var(--font-mono);
    font-weight: 500;
}

.char-counter #charCount {
    color: var(--gray-700);
}

.char-limit {
    color: var(--gray-400);
}

.textarea-actions {
    display: flex;
    gap: 8px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    text-decoration: none;
    outline: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), var(--danger-hover));
    color: var(--white);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 8px;
    border-radius: 50%;
    background: var(--white);
    border: 1px solid var(--gray-200);
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.btn-icon:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--gray-300);
    color: var(--gray-800);
}

.btn-icon.btn-danger {
    background: var(--white);
    color: var(--danger);
    border-color: var(--danger-light);
}

.btn-icon.btn-danger:hover:not(:disabled) {
    background: var(--danger-light);
}

.creator-actions {
    padding: 24px;
    display: flex;
    justify-content: center;
}

.btn-save {
    padding: 14px 40px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
}

.btn-save svg {
    width: 20px;
    height: 20px;
}

.btn-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.spinner-btn {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Ripple effect */
.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease-out, height 0.6s ease-out, opacity 0.6s ease-out;
    pointer-events: none;
}

.btn:active::after {
    width: 300px;
    height: 300px;
    opacity: 0;
}

/* ============================================
   RESULT SECTION
   ============================================ */
.result-section {
    padding: 0 24px 24px;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-card {
    background: var(--success-light);
    border: 1px solid #a7f3d0;
    border-radius: var(--radius-lg);
    padding: 20px;
    animation: successPulse 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes successPulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    font-weight: 600;
    color: var(--success);
}

.success-icon {
    width: 24px;
    height: 24px;
}

.result-url {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.result-url input {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--gray-700);
    background: var(--white);
    transition: border-color var(--transition-fast);
    outline: none;
}

.result-url input:focus {
    border-color: var(--primary);
}

/* ============================================
   SHORTCUTS HINT
   ============================================ */
.shortcuts-hint {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    padding: 10px 0;
}

.shortcuts-hint span {
    font-size: 0.8rem;
    color: var(--gray-400);
}

.shortcuts-hint kbd {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    color: var(--gray-600);
}

/* ============================================
   VIEWER CARD
   ============================================ */
.viewer-card {
    margin-bottom: 20px;
}

.viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: rgba(249, 250, 251, 0.8);
    border-bottom: 1px solid var(--gray-200);
    flex-wrap: wrap;
    gap: 12px;
}

.code-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.code-icon {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.code-text {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-dark);
    letter-spacing: 0.5px;
}

.viewer-actions {
    display: flex;
    gap: 8px;
}

.viewer-content {
    padding: 24px;
    min-height: 300px;
}

.viewer-text {
    background: rgba(249, 250, 251, 0.8);
    border-radius: var(--radius-md);
    padding: 24px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--gray-800);
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid var(--gray-200);
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 20px;
    color: var(--gray-500);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.viewer-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 20px;
    color: var(--gray-500);
    text-align: center;
}

.viewer-error svg {
    width: 48px;
    height: 48px;
    color: var(--danger);
}

.viewer-footer {
    padding: 12px 24px;
    border-top: 1px solid var(--gray-200);
    background: rgba(249, 250, 251, 0.5);
}

.delete-status {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-weight: 500;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    text-align: center;
    padding: 20px;
    margin-top: auto;
}

.footer p {
    font-size: 0.8rem;
    color: var(--gray-400);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: all;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    background: var(--white);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 280px;
    max-width: 400px;
    border-left: 4px solid var(--primary);
}

.toast.toast-success {
    border-left-color: var(--success);
}

.toast.toast-error {
    border-left-color: var(--danger);
}

.toast.toast-warning {
    border-left-color: #f59e0b;
}

.toast-exit {
    animation: toastOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0) translateY(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%) translateY(20px);
    }
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    padding: 32px;
    max-width: 450px;
    width: 100%;
}

.modal-card h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--gray-800);
}

.modal-card p {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .header {
        padding: 20px 10px 15px;
    }

    .logo-text {
        font-size: 1.5rem;
    }

    .logo-icon {
        width: 28px;
        height: 28px;
    }

    #pasteTextarea {
        min-height: 250px;
        padding: 16px;
        font-size: 0.85rem;
    }

    .textarea-footer {
        padding: 10px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .textarea-actions {
        width: 100%;
    }

    .textarea-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .btn-save {
        width: 100%;
        justify-content: center;
    }

    .viewer-header {
        padding: 12px 16px;
    }

    .viewer-content {
        padding: 16px;
    }

    .viewer-text {
        padding: 16px;
        font-size: 0.85rem;
        max-height: 50vh;
    }

    .viewer-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .result-url {
        flex-direction: column;
    }

    .result-url input {
        width: 100%;
    }

    .result-url .btn {
        width: 100%;
        justify-content: center;
    }

    .shortcuts-hint {
        gap: 10px;
    }

    .toast-container {
        bottom: 12px;
        right: 12px;
        left: 12px;
    }

    .toast {
        min-width: auto;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .header-tagline {
        font-size: 0.8rem;
    }

    .code-text {
        font-size: 0.9rem;
    }

    .btn-icon {
        width: 36px;
        height: 36px;
    }

    .btn-icon svg {
        width: 16px;
        height: 16px;
    }
}