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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 25%, #6366f1 50%, #3b82f6 75%, #6366f1 100%);
    min-height: 100vh;
    color: #334155;
    overflow-x: hidden;
}

/* ===== DECORATIVE BACKGROUND ===== */
.bg-decor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* Diagonal streaks like the reference image */
.streak {
    position: absolute;
    border-radius: 50px;
    transform: rotate(-35deg);
}

.streak-1 {
    width: 300px;
    height: 60px;
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.6), rgba(96, 165, 250, 0.4));
    top: -5%;
    left: -5%;
    animation: floatStreak1 14s ease-in-out infinite;
}

.streak-2 {
    width: 220px;
    height: 45px;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.5), rgba(147, 197, 253, 0.3));
    top: 8%;
    left: -2%;
    animation: floatStreak1 16s ease-in-out infinite 2s;
}

.streak-3 {
    width: 350px;
    height: 55px;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.4), rgba(167, 139, 250, 0.5));
    bottom: 5%;
    right: -8%;
    animation: floatStreak2 15s ease-in-out infinite;
}

.streak-4 {
    width: 250px;
    height: 40px;
    background: linear-gradient(90deg, rgba(147, 197, 253, 0.4), rgba(196, 181, 253, 0.5));
    bottom: 15%;
    right: -3%;
    animation: floatStreak2 13s ease-in-out infinite 3s;
}

/* Floating blobs */
.blob {
    position: absolute;
    border-radius: 50%;
}

.blob-1 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, transparent 70%);
    top: 10%;
    right: -5%;
    animation: floatBlob 18s ease-in-out infinite;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
    bottom: 5%;
    left: -5%;
    animation: floatBlob 20s ease-in-out infinite 4s;
}

/* Sparkle stars */
.sparkle {
    position: absolute;
    color: rgba(255, 255, 255, 0.7);
    animation: twinkle 3s ease-in-out infinite;
}

.sparkle-1 {
    font-size: 1.4rem;
    top: 12%;
    left: 15%;
    animation-delay: 0s;
}

.sparkle-2 {
    font-size: 1rem;
    top: 25%;
    right: 18%;
    animation-delay: 1s;
}

.sparkle-3 {
    font-size: 1.8rem;
    top: 8%;
    right: 30%;
    animation-delay: 0.5s;
}

.sparkle-4 {
    font-size: 1.2rem;
    bottom: 20%;
    left: 10%;
    animation-delay: 1.5s;
}

.sparkle-5 {
    font-size: 0.9rem;
    bottom: 30%;
    right: 12%;
    animation-delay: 2s;
}

/* ===== ANIMATIONS ===== */
@keyframes floatStreak1 {
    0%, 100% { transform: rotate(-35deg) translate(0, 0); }
    50% { transform: rotate(-35deg) translate(20px, 15px); }
}

@keyframes floatStreak2 {
    0%, 100% { transform: rotate(-35deg) translate(0, 0); }
    50% { transform: rotate(-35deg) translate(-20px, -10px); }
}

@keyframes floatBlob {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-20px, 15px) scale(1.05); }
    66% { transform: translate(15px, -10px) scale(0.95); }
}

@keyframes twinkle {
    0%, 100% { opacity: 0.4; transform: scale(0.8) rotate(0deg); }
    50% { opacity: 1; transform: scale(1.2) rotate(20deg); }
}

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

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

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

/* ===== AUTH SECTION ===== */
#authSection {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    animation: fadeInUp 0.6s ease-out;
}

/* Title */
.app-title {
    font-family: 'Outfit', sans-serif;
    text-align: center;
    font-size: 3rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: -1px;
    margin-bottom: 4px;
    text-shadow: 0 2px 20px rgba(139, 92, 246, 0.3);
}

.app-subtitle {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    font-weight: 300;
    margin-bottom: 28px;
    letter-spacing: 0.5px;
}

/* Auth form card */
.auth-form {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(24px);
    padding: 44px 40px;
    border-radius: 28px;
    box-shadow:
        0 8px 32px rgba(99, 102, 241, 0.15),
        0 24px 68px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.6);
    margin-top: 0;
    animation: fadeInUp 0.7s ease-out 0.1s both;
    position: relative;
    overflow: hidden;
}

/* Animated gradient top border */
.auth-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #7c3aed, #8b5cf6, #6366f1, #3b82f6, #60a5fa, #3b82f6, #6366f1, #8b5cf6, #7c3aed);
    background-size: 300% 100%;
    animation: gradientShift 6s ease infinite;
}

.auth-form h2 {
    font-family: 'Outfit', sans-serif;
    color: #4c1d95;
    font-size: 1.8rem;
    margin-bottom: 24px;
    text-align: center;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.auth-form input {
    width: 100%;
    padding: 15px 18px;
    margin-bottom: 14px;
    border: 2px solid #e9e5f5;
    border-radius: 14px;
    font-size: 0.95rem;
    font-family: 'Poppins', sans-serif;
    background: #faf8ff;
    color: #334155;
    transition: all 0.3s ease;
}

.auth-form input::placeholder {
    color: #a5a0c0;
}

.auth-form input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.12), 0 2px 12px rgba(139, 92, 246, 0.08);
    transform: translateY(-1px);
}

.switch-form {
    text-align: center;
    margin-top: 22px;
    color: #9892b3;
    font-size: 0.88rem;
}

.switch-form a {
    color: #7c3aed;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    position: relative;
}

.switch-form a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #7c3aed, #3b82f6);
    transition: width 0.3s ease;
    border-radius: 1px;
}

.switch-form a:hover {
    color: #6d28d9;
}

.switch-form a:hover::after {
    width: 100%;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 14px;
    font-size: 0.95rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Shine sweep */
.btn-primary::after,
.btn-search::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::after,
.btn-search:hover::after {
    left: 130%;
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, #7c3aed 0%, #6366f1 50%, #3b82f6 100%);
    color: #fff;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.35);
    letter-spacing: 0.02em;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #6d28d9 0%, #4f46e5 50%, #2563eb 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(124, 58, 237, 0.4);
}

.btn-primary:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3);
}

.btn-search {
    background: linear-gradient(135deg, #7c3aed, #3b82f6);
    color: #fff;
    padding: 14px 32px;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
}

.btn-search:hover {
    background: linear-gradient(135deg, #6d28d9, #2563eb);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(124, 58, 237, 0.35);
}

.btn-logout {
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.85);
    padding: 8px 22px;
    font-size: 0.88rem;
    backdrop-filter: blur(10px);
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
    transform: translateY(-1px);
}

.btn-edit {
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    color: #fff;
    padding: 8px 18px;
    font-size: 0.82rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(124, 58, 237, 0.2);
}

.btn-edit:hover {
    background: linear-gradient(135deg, #6d28d9, #4f46e5);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
}

.btn-delete {
    background: rgba(255, 255, 255, 0.7);
    border: 1.5px solid #e2e0ee;
    color: #9892b3;
    padding: 8px 18px;
    font-size: 0.82rem;
    border-radius: 10px;
}

.btn-delete:hover {
    border-color: #fca5a5;
    color: #ef4444;
    background: rgba(254, 226, 226, 0.5);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: #fff;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c, #dc2626);
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(220, 38, 38, 0.3);
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.8);
    color: #7c7a92;
    border: 1.5px solid #e2e0ee;
}

.btn-cancel:hover {
    background: #f3f0ff;
    color: #4c1d95;
    border-color: #c4b5fd;
}

/* ===== MESSAGES ===== */
.message {
    text-align: center;
    margin-top: 15px;
    font-size: 0.88rem;
    min-height: 20px;
    font-weight: 500;
}

.message.error {
    color: #ef4444;
}

.message.success {
    color: #7c3aed;
}

/* ===== CONTACTS SECTION ===== */
#contactsSection {
    min-height: 100vh;
    padding-bottom: 40px;
    position: relative;
    z-index: 1;
}

header {
    background: rgba(109, 40, 217, 0.3);
    padding: 18px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(24px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

header .app-title {
    font-size: 1.7rem;
    margin-bottom: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

#welcomeUser {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    font-weight: 500;
}

/* ===== CARDS ===== */
.contacts-container {
    max-width: 880px;
    margin: 30px auto;
    padding: 0 20px;
}

.card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 32px;
    margin-bottom: 22px;
    box-shadow:
        0 4px 16px rgba(99, 102, 241, 0.08),
        0 12px 40px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.6);
    animation: fadeInUp 0.5s ease-out both;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card:hover {
    box-shadow:
        0 4px 16px rgba(99, 102, 241, 0.12),
        0 16px 48px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }

/* Gradient accent on hover */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #7c3aed, #8b5cf6, #6366f1, #3b82f6, #60a5fa);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover::before {
    opacity: 1;
}

.card h2 {
    font-family: 'Outfit', sans-serif;
    color: #4c1d95;
    font-size: 1.3rem;
    margin-bottom: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.2px;
}

.card h2::before {
    content: '';
    width: 4px;
    height: 22px;
    background: linear-gradient(180deg, #7c3aed, #3b82f6);
    border-radius: 3px;
    flex-shrink: 0;
}

.form-row {
    display: flex;
    gap: 14px;
    margin-bottom: 14px;
}

.form-row input {
    flex: 1;
    padding: 13px 16px;
    border: 2px solid #e9e5f5;
    border-radius: 14px;
    font-size: 0.95rem;
    font-family: 'Poppins', sans-serif;
    background: #faf8ff;
    color: #334155;
    transition: all 0.3s ease;
}

.form-row input::placeholder {
    color: #a5a0c0;
}

.form-row input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1), 0 2px 12px rgba(139, 92, 246, 0.06);
    transform: translateY(-1px);
}

.add-contact-card .btn-primary {
    margin-top: 8px;
}

/* Search */
.search-row {
    display: flex;
    gap: 14px;
}

.search-row input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid #e9e5f5;
    border-radius: 14px;
    font-size: 0.95rem;
    font-family: 'Poppins', sans-serif;
    background: #faf8ff;
    color: #334155;
    transition: all 0.3s ease;
}

.search-row input::placeholder {
    color: #a5a0c0;
}

.search-row input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1), 0 2px 12px rgba(139, 92, 246, 0.06);
    transform: translateY(-1px);
}

/* ===== CONTACTS LIST ===== */
#contactsList {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.contact-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    background: #faf8ff;
    border-radius: 16px;
    border: 1px solid #ece8f5;
    border-left: 4px solid #a78bfa;
    transition: all 0.3s ease;
}

.contact-item:hover {
    background: #fff;
    border-color: #ddd6fe;
    border-left-color: #7c3aed;
    transform: translateX(6px);
    box-shadow: 0 4px 24px rgba(124, 58, 237, 0.1);
}

.contact-info h3 {
    font-family: 'Outfit', sans-serif;
    color: #4c1d95;
    font-size: 1.08rem;
    margin-bottom: 4px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.contact-info p {
    color: #7c7a92;
    font-size: 0.88rem;
    margin: 2px 0;
}

.contact-info p span {
    color: #a5a0c0;
    margin-right: 5px;
}

.contact-actions {
    display: flex;
    gap: 8px;
}

.no-contacts {
    text-align: center;
    color: #a5a0c0;
    padding: 40px;
    font-size: 0.95rem;
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(76, 29, 149, 0.25);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
    animation: fadeInUp 0.2s ease-out;
}

.modal-content {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(24px);
    padding: 38px;
    border-radius: 28px;
    width: 90%;
    max-width: 450px;
    position: relative;
    box-shadow:
        0 8px 32px rgba(124, 58, 237, 0.12),
        0 25px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.6);
    overflow: hidden;
    animation: fadeInUp 0.35s ease-out;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #7c3aed, #8b5cf6, #6366f1, #3b82f6, #60a5fa, #3b82f6, #6366f1, #8b5cf6, #7c3aed);
    background-size: 300% 100%;
    animation: gradientShift 6s ease infinite;
}

.modal-small {
    max-width: 380px;
    text-align: center;
}

.modal-content h2 {
    font-family: 'Outfit', sans-serif;
    color: #4c1d95;
    margin-bottom: 25px;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.modal-content input {
    width: 100%;
    padding: 13px 16px;
    margin-bottom: 14px;
    border: 2px solid #e9e5f5;
    border-radius: 14px;
    font-size: 0.95rem;
    font-family: 'Poppins', sans-serif;
    background: #faf8ff;
    color: #334155;
    transition: all 0.3s ease;
}

.modal-content input::placeholder {
    color: #a5a0c0;
}

.modal-content input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
}

.modal-content p {
    color: #7c7a92;
    margin-bottom: 25px;
    line-height: 1.5;
}

.close-modal {
    position: absolute;
    top: 18px;
    right: 22px;
    font-size: 1.6rem;
    color: #c4b5fd;
    cursor: pointer;
    transition: all 0.3s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-modal:hover {
    color: #7c3aed;
    background: rgba(139, 92, 246, 0.08);
}

.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-buttons .btn {
    flex: 1;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .app-title {
        font-size: 2.2rem;
    }

    .auth-form {
        padding: 32px 26px;
    }

    .streak { display: none; }

    header {
        flex-direction: column;
        gap: 15px;
        padding: 15px 20px;
    }

    header .app-title {
        font-size: 1.4rem;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-row input {
        margin-bottom: 14px;
    }

    .search-row {
        flex-direction: column;
    }

    .search-row .btn-search {
        width: 100%;
    }

    .contact-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .contact-actions {
        width: 100%;
    }

    .contact-actions .btn {
        flex: 1;
    }

    .modal-buttons {
        flex-direction: column;
    }
}
