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

body {
    font-family: "Ubuntu", sans-serif;
    background: rgb(50, 49, 49);
    display: flex;
    justify-content: center;
    padding: 20px;
    color: rgb(214, 214, 214);
    min-height: 100vh;
}

.container {
    padding: 20px;
    width: 100%;
    max-width: 800px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(190, 178, 178, 0.2);
    border: 2px solid rgb(214, 214, 214);
    background: rgb(50, 49, 49);
}

h1 {
    text-align: center;
    margin-bottom: 20px;
}

form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

form input {
    flex: 1;
    min-width: 120px; /* Prevents inputs from getting too small */
    padding: 10px;
    border-radius: 10px;
    border-style: none;
    outline: none;
}

form input:focus {
    box-shadow: 1px 1px 5px 1px rgb(214, 214, 214);
}

form button {
    padding: 10px 20px;
    cursor: pointer;
    color: rgb(66, 63, 63);
    border: 1px solid white;
    background-color: white;
    border-radius: 7px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

form button:hover {
    background: rgb(66, 63, 63);
    color: rgb(214, 214, 214);
}

#message {
    text-align: center;
    margin-bottom: 10px;
    font-weight: bold;
    color: red;
    min-height: 20px; /* Keeps layout from jumping */
}

.table-container {
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    border-bottom: 1px solid rgb(214, 214, 214);
    text-align: center;
}

th {
    background-color: rgb(66, 63, 63);
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.delete, .edit {
    color: rgb(214, 214, 214);
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.3s;
}

.delete:hover {
    color: rgb(220, 4, 4);
}

.edit:hover {
    color: rgb(14, 205, 58);
}

/* =========================================
   Mobile Responsiveness (Max-width 600px)
   ========================================= */
@media (max-width: 600px) {
    /* Stack form elements */
    form {
        flex-direction: column;
    }
    
    form button {
        width: 100%; /* Full width button on mobile */
    }

    /* Convert Table to Card Layout */
    table, thead, tbody, th, td, tr {
        display: block;
    }

    /* Hide standard table headers */
    thead tr {
        display: none;
    }

    /* Style the rows as individual cards */
    tr {
        margin-bottom: 15px;
        border: 1px solid rgb(214, 214, 214);
        border-radius: 8px;
        padding: 10px;
        background: rgb(66, 63, 63);
    }

    /* Flex layout for each cell to show label on left, data on right */
    td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        border-bottom: 1px solid rgba(214, 214, 214, 0.2);
        padding: 10px 5px;
    }

    /* Remove border from last item in the card */
    td:last-child {
        border-bottom: none;
    }

    /* Inject the data-label before the actual content */
    td::before {
        content: attr(data-label);
        font-weight: bold;
        text-align: left;
        flex: 1;
        color: rgb(214, 214, 214);
    }

    /* Align action buttons to the right inside the flex cell */
    .action-buttons {
        justify-content: flex-end;
    }
}