:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #1da1f2;
    --accent-hover: #1a91da;
    --error: #ef4444;
    --success: #10b981;
}

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

body {
    margin: 0;
    padding: 2rem 1rem;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
    overflow-x: hidden;
}

/* Background Blobs */
.background-blobs {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    animation: breathe 8s infinite ease-in-out;
}

.blob-1 {
    top: -15%;
    left: -15%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(29,161,242,0.8) 0%, rgba(15,23,42,0) 70%);
}

.blob-2 {
    bottom: -15%;
    right: -15%;
    width: 70vw;
    height: 70vw;
    background: radial-gradient(circle, rgba(99,102,241,0.7) 0%, rgba(15,23,42,0) 70%);
    animation-delay: -4s;
}

@keyframes breathe {
    0% { transform: scale(0.9); opacity: 0.4; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.4; }
}

.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 550px;
    padding: 1rem; /* reduced from 2rem to prevent double spacing since body now has padding */
    margin: auto; /* this ensures it's vertically centered if smaller than viewport, but scrolls nicely if taller */
    animation: fadeInContainer 0.8s ease-out forwards;
    opacity: 0;
}

@keyframes fadeInContainer {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.header {
    text-align: center;
    margin-bottom: 3rem;
    animation: slideDown 0.6s ease-out forwards;
    opacity: 0;
    animation-delay: 0.2s;
}

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

.logo {
    margin-bottom: 1rem;
    display: inline-block;
}

.twitter-icon {
    width: 72px;
    height: 72px;
    object-fit: contain;
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.2));
    animation: floatLogo 3s ease-in-out infinite alternate;
}

@keyframes floatLogo {
    from { transform: translateY(0px) scale(1); }
    to { transform: translateY(-8px) scale(1.05); }
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Glassmorphism Card */
.glass-effect {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.5);
    animation: slideUpFade 0.6s ease-out forwards;
    opacity: 0;
    animation-delay: 0.4s;
    position: relative;
    overflow: hidden;
}

/* Kilatan Animasi / Shine Effect */
.glass-effect::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 30%;
    height: 100%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.1) 45%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0.1) 55%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: skewX(-25deg);
    animation: shine 6s infinite ease-in-out;
    pointer-events: none;
}

@keyframes shine {
    0% { left: -100%; }
    30% { left: 200%; }
    100% { left: 200%; }
}

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

.input-group {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    padding: 0.5rem;
    transition: all 0.3s ease;
}

.input-group:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(29, 161, 242, 0.1);
}

.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }

.cookie-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.cookie-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

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

.cookie-input-group input[type="password"] {
    flex-grow: 1;
    min-width: 0;
    background: transparent;
    border: none;
    padding: 0.85rem 1rem 0.85rem 3rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
}

.cookie-input-group input[type="password"]::placeholder {
    color: var(--text-secondary);
}

/* Fix for Chrome autofill background turning white */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #0f172a inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    transition: background-color 5000s ease-in-out 0s;
}

.full-width-btn {
    width: 100%;
    justify-content: center;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 100px;
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.full-width-btn:hover {
    background: #1a91da;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(29, 161, 242, 0.4);
}

/* Help Section */
.help-section {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
}

.help-toggle {
    width: 100%;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.help-toggle:hover {
    color: var(--accent);
}

.help-content {
    padding: 0 1rem 1rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.help-method h4 {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.help-method h4 i.fa-star {
    color: #facc15;
}

.help-method p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.help-method ol {
    margin: 0;
    padding-left: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

.help-method a {
    color: var(--accent);
    text-decoration: none;
}

.help-method a:hover {
    text-decoration: underline;
}

.ext-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary) !important;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-decoration: none !important;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1rem;
    transition: background 0.2s;
}

.ext-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.ext-logo {
    width: 20px;
    height: 20px;
}

.icon-left {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

/* Edit Cookies Button */
.shortener-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.shortener-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.edit-cookies-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.edit-cookies-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.input-group:focus-within .icon-left {
    color: var(--accent);
}

input[type="url"] {
    flex-grow: 1;
    min-width: 0;
    background: transparent;
    border: none;
    padding: 0.85rem 1rem 0.85rem 3rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
}

input[type="url"]::placeholder {
    color: var(--text-secondary);
}

.paste-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    padding: 0 0.75rem;
    margin-right: 0.5rem;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.paste-btn:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

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

button[type="submit"] {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 100px;
    padding: 0.7rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

button[type="submit"]:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

button[type="submit"]:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Loader */
.loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

/* Colorful animated loader */
.loader.colorful {
    border-top-color: #ff3366;
    border-right-color: #20c997;
    border-bottom-color: #3b82f6;
    border-left-color: #f59e0b;
    border-width: 4px;
    animation: spin 0.7s linear infinite;
}

/* Rainbow button during loading */
button.loading-rainbow {
    background: linear-gradient(45deg, #ff0055, #0099ff, #00ff99, #ffcc00);
    background-size: 300% 300%;
    animation: rainbowPulse 2s ease infinite;
    color: white;
    border: none;
}

@keyframes rainbowPulse {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

/* Results */
.result-container {
    margin-top: 2rem;
    animation: slideUp 0.4s ease forwards;
}

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

.result-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(29, 161, 242, 0.1);
    border: 1px dashed rgba(29, 161, 242, 0.3);
    border-radius: 16px;
    padding: 1.5rem;
}

.result-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow: hidden;
}

.result-info .label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.result-info a {
    color: var(--accent);
    font-size: 1.25rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

.result-info a:hover {
    text-decoration: underline;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-left: 1rem;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--accent);
}

.icon-btn.copied {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.error-message {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--error);
    border-radius: 8px;
    color: #fca5a5;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideUp 0.3s ease;
}

@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }
    
    .glass-effect {
        padding: 1.5rem;
    }

    .input-group {
        flex-direction: column;
        border-radius: 16px;
        background: transparent;
        border: none;
        padding: 0;
    }

    input[type="url"] {
        width: 100%;
        background: rgba(15, 23, 42, 0.6);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        margin-bottom: 1rem;
    }

    button[type="submit"] {
        width: 100%;
        justify-content: center;
        border-radius: 12px;
    }
}

/* History Section */
.history-section {
    margin-top: 2rem;
    animation: slideUpFade 0.6s ease-out forwards;
    opacity: 0;
    animation-delay: 0.6s;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0 0.5rem;
}

.history-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.clear-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
    font-size: 1rem;
    padding: 0.5rem;
}

.clear-btn:hover {
    color: var(--error);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item {
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(29, 161, 242, 0.2);
    transform: translateY(-2px);
}

.history-links {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow: hidden;
    padding-right: 1rem;
}

.history-links .original {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-links .shortened {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

.history-links .shortened:hover {
    text-decoration: underline;
}

.copy-hist-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.copy-hist-btn:hover {
    background: rgba(29, 161, 242, 0.1);
    color: var(--accent);
}

.copy-hist-btn.copied {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

/* Elegant Footer */
.elegant-footer {
    margin-top: 4rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    padding-bottom: 1rem;
    animation: slideUpFade 0.6s ease-out forwards;
    animation-delay: 0.8s;
    opacity: 0;
}

.elegant-footer:hover {
    opacity: 1;
}

.elegant-footer p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.pulse-icon {
    color: #ef4444;
    display: inline-block;
    animation: heartbeat 1.5s infinite;
}

.steam-icon {
    color: #fbbf24;
}

.brand-name {
    font-weight: 700;
    color: var(--text-primary);
    background: linear-gradient(to right, #1da1f2, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.est-text {
    font-size: 0.75rem;
    opacity: 0.8;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    15% { transform: scale(1.25); }
    30% { transform: scale(1); }
    45% { transform: scale(1.25); }
    60% { transform: scale(1); }
}

/* Custom Alert Toast */
.custom-alert {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 380px;
    max-width: calc(100vw - 40px);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border-left: 4px solid var(--error);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    gap: 1rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
    z-index: 1000;
    transform: translateX(120%);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s ease;
    opacity: 0;
}

.custom-alert.show {
    transform: translateX(0);
    opacity: 1;
    animation: gentleShake 0.5s ease-in-out 0.5s;
}

.custom-alert .alert-icon {
    font-size: 1.5rem;
    color: #fca5a5;
    padding-top: 0.2rem;
}

.custom-alert .alert-content h4 {
    color: #fca5a5;
    margin: 0 0 0.4rem 0;
    font-size: 1rem;
}

.custom-alert .alert-content p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.5;
}

.alert-action-btn {
    margin-top: 0.75rem;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.alert-action-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    color: white;
}

.close-alert-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    height: fit-content;
    transition: color 0.2s, transform 0.2s;
}

.close-alert-btn:hover {
    color: white;
    transform: scale(1.1);
}

@keyframes gentleShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px) rotate(-2deg); }
    50% { transform: translateX(6px) rotate(2deg); }
    75% { transform: translateX(-6px) rotate(-2deg); }
}

