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

body {
    background: #d8cbbd;
    font-family: system-ui, sans-serif;
}

/* Navbar */
.navbar {
    background: #6E6050;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    width: 112px;
}

.navbar h1 {
    color: white;
    font-size: 32px;
    font-weight: 600;
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-size: 18px;
    font-weight: 500;
}

/* Container */
.container {
    flex: 1;
    max-width: 1400px;
    padding: 40px 40px 80px;
    margin: 0 auto;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.top-bar h2 {
    font-size: 42px;
    font-weight: 700;
    color: #2c2416;
}

.search-add {
    display: flex;
    gap: 15px;
}

#searchText {
    padding: 14px 20px;
    border: none;
    border-radius: 25px;
    background: white;
    font-size: 16px;
    width: 280px;
}

.add-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 25px;
    background: #5d4e3c;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.search {
    padding: 14px 28px;
    border: none;
    border-radius: 25px;
    background: #5d4e3c;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

/* Grid For Contacts Tabs */
.card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 30px;
    max-height: 65vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    margin: 0 auto;
    max-width: 1200px;
}

.contact-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    animation: cardFadeIn 0.45s ease both;
}

.contact-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.15);
}

.contact-card:nth-child(1) { animation-delay: 0s; }
.contact-card:nth-child(2) { animation-delay: 0.06s; }
.contact-card:nth-child(3) { animation-delay: 0.12s; }
.contact-card:nth-child(4) { animation-delay: 0.18s; }
.contact-card:nth-child(5) { animation-delay: 0.24s; }
.contact-card:nth-child(6) { animation-delay: 0.3s; }
.contact-card:nth-child(7) { animation-delay: 0.36s; }
.contact-card:nth-child(8) { animation-delay: 0.42s; }
.contact-card:nth-child(9) { animation-delay: 0.48s; }
.contact-card:nth-child(n+10) { animation-delay: 0.54s; }

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

.card-top {
    height: 50px;
    background: linear-gradient(135deg, #009345 0%, #4caf82 100%);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 2px 8px rgba(0, 147, 69, 0.25);
    border-bottom: 2px solid rgba(0, 147, 69, 0.4);
}

.card-body {
    padding: 25px;
}

.card-body h3 {
    font-size: 28px;
    font-weight: 700;
    color: #2c2416;
    margin-bottom: 8px;
}

.contact-info {
    color: #666;
    font-size: 15px;
    margin-bottom: 12px;
}

.notes {
    color: #555;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
    min-height: 42px;
}

.card-actions {
    display: flex;
    gap: 12px;
}

.edit-btn,
.delete-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.edit-btn:hover,
.delete-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}

.edit-btn {
    background: #5d4e3c;
    color: white;
}

.delete-btn {
    background: #c94659;
    color: white;
}

/* Footer */
.footer {
    background: #27221C;
    color: white;
    text-align: center;
    padding: 32px 20px;
    font-size: 15px;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
}


/* Popup appears when prompting to add, edit, or delete a contact */
#popup {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgb(0,0,0); /* If opacity is not supported, plain black will be used */
    background-color: rgba(0,0,0,0.4);
}

#popup-content {
    background-color: #fefefe;
    margin: 10% auto;
    width: fit-content;
    border-radius: 20px;
}

#popup-content > .card-body {
    min-height: 0;
}

#close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    padding-right: 2%;
}

#close:hover,
#close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

textarea {
    padding: 12px 16px;
    border-radius: 22px;
    border: none;
    background: #eee;
    font-size: 14px;
}

input:invalid {
    border: none;
}

input:valid {
    border: none;
}

#contactFormSubmitButton:hover {
    cursor: pointer;
    background: grey;
}

.contactFormInput {
    margin: 1%;
}

#notes {
    resize: vertical;
}