@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');

/* main colour scheme and font for site */
:root {
    --bg-color: #121212; /* background */
    --surface-color: #1e1e1e; /* boxes background */
    --primary-color: #6a5acd; /* primary accent */
    --primary-hover-color: #7b68ee; /* primary color when hovered */
    --text-color: #e0e0e0; /* text colour */
    --text-dark-color: #a0a0a0; /* darker text */
    --border-color: #333333; /* border of boxes */
    --font-family: 'Poppins', sans-serif; /* cool font */
}

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

/* set global propeties */
body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 2rem 1rem;
}

/* contains entire content of site */
.container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* header at the top */
.header {
    text-align: center;
}

/* title text */
.header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}
      
/* email icon */
.header h1 img {
    width: 36px;
    height: 36px;
    filter: invert(39%) sepia(58%) saturate(1461%) hue-rotate(225deg) brightness(91%) contrast(93%); /* stupid ai generated code to get the email icon to match the primary colour */
}

/* description text */
.header p {
    color: var(--text-dark-color);
    font-size: 1.1rem;
}

/* email action panel box */
.email-panel {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: fadeIn 0.5s ease-in-out; /* plays the cool fade in animation defined at the bottom of the css */
}

/* current email text box */
.email-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--bg-color);
    border-radius: 8px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
}


/* current email text */
#email-input {
    flex-grow: 1;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1rem;
    font-family: var(--font-family);
}

/* stop it from looking weird when you click the email */
#email-input:focus {
    outline: none;
}

/* action button container */
.action-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* action buttons */
.btn {
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* button icons */
.btn img {
    width: 16px;
    height: 16px;
    filter: brightness(0) invert(1);
}

/* primary button (generate email) */
.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

/* hover effect */
.btn-primary:hover {
    background-color: var(--primary-hover-color);
    transform: translateY(-2px);
}

/* secondary buttons */
.btn-secondary {
    background-color: #333;
    color: var(--text-color);
}
        
/* hover effect */
.btn-secondary:hover {
    background-color: #444;
    transform: translateY(-2px);
}

/* inbox display box */
.inbox-section {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    animation: fadeIn 0.7s ease-in-out;
}

/* inbox box title and refresh button container */
.inbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* inbox box title */
.inbox-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}
 
/* refresh inbox button */
#refresh-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s ease, transform 0.3s ease;
}
     
/* refresh inbox button icon */
#refresh-btn img {
    width: 20px;
    height: 20px;
    transition: filter 0.2s ease;
    filter: brightness(0) invert(1);
}

/* refresh button hover */
#refresh-btn:hover {
    background-color: #333;
}

/* spin effect when refreshing */
#refresh-btn.loading img {
    animation: spin 1s linear infinite;
}

/* list of emails */
#inbox-list {
    list-style: none;
}

/* placeholder when no emails present */
#inbox-placeholder {
    text-align: center;
    padding: 2rem;
    color: var(--text-dark-color);
}

/* single email */
.email-item {
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

/* dont add line if its the last one */
.email-item:last-child {
    border-bottom: none;
}

/* hover over email */
.email-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* sender and subject container */
.email-details {
    min-width: 0;
}

/* summary excluding body */
.email-summary {
    padding: 1rem;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1rem;
}

/* sender text */
.email-summary .sender {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* email subject text */
.email-summary .subject {
    color: var(--text-dark-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* time sent text */
.email-summary .time {
    color: var(--text-dark-color);
    font-size: 0.85rem;
    text-align: right;
}

/* the body container (closed) */
.email-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out;
    padding: 0 1rem;
}
 
/* email body iframe */
.email-body-iframe {
    width: 100%;
    height: 400px;
    border: none;
    border-radius: 8px;
}

/* the body container (open) */
.email-item.open .email-body {
    max-height: 1000px;
    padding-bottom: 1rem;
}

/* animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
        
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* mobile design */
@media (max-width: 600px) {
    /* make buttons turn into icons */
    .button-text {
        display: none;
    }

    .action-buttons {
        justify-content: center;
    }
}