/* =================================================================
   BASE & LAYOUT
   ================================================================= */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f4f9;
    color: #333;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* Generic container for all main page views */
#shop-view, #login-view, #cart-view, #account-view, #admin-main-view {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin: 2rem;
    width: 100%;
    max-width: 1200px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

main {
    flex-grow: 1;
}

footer {
    width: 100%;
    text-align: center;
    padding: 1rem 0;
    margin-top: auto;
    color: #666;
    font-size: 0.9rem;
}

/* =================================================================
   TYPOGRAPHY & FORMS
   ================================================================= */

h1, h2, h3, h4 {
    color: #5a2a5a;
}

a {
    color: #5a2a5a;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"],
textarea {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

button, .button {
    background-color: #5a2a5a;
    color: white;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    white-space: nowrap;
    text-align: center;
}
button:hover, .button:hover {
    background-color: #482248;
}
button:disabled, .button:disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
}
button:disabled:hover, .button:disabled:hover {
    background-color: #cccccc;
}


.error-message {
    color: #d8000c;
    background-color: #ffbaba;
    padding: 0.5rem;
    border-radius: 4px;
    margin-top: 1rem;
    display: none; /* Hide by default */
}

.error-message:not(:empty) {
    display: block; /* Show only when it has content */
}
.info-message {
    background-color: #e7f3fe; /* Light blue */
    color: #31708f; /* Darker blue text */
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #bce8f1;
    text-align: center;
}

/* =================================================================
   HEADER & NAVIGATION
   ================================================================= */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    border-bottom: 2px solid #eee;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

header h1 {
    margin: 0;
}
header h1 a {
    color: inherit;
    text-decoration: none;
}

header nav {
    display: flex;
    gap: 15px;
    align-items: center;
}
header nav a {
    padding: 0.5rem 0;
}

.nav-btn {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
}
.nav-btn.active {
    background-color: #5a2a5a;
    color: white;
    border-color: #5a2a5a;
}

/* =================================================================
   ADMIN-SPECIFIC STYLES
   ================================================================= */
#admin-login-view {
    width: 100%;
    max-width: 400px;
    margin: auto;
    padding: 2rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* =================================================================
   FLOWER CATALOG & ITEMS
   ================================================================= */

#flower-catalog, #flower-list {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}
#flower-catalog.is-empty {
    display: block;
}


.flower-item {
    background: #f9f9f9;
    border: 1px solid #eee;
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}
.flower-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 1rem;
}
.flower-item p {
    margin: 0.25rem 0;
}
.actions-container {
    margin-top: auto;
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.quantity-control {
    display: flex;
    align-items: center;
    width: 100%;
}

.quantity-selector {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}
.quantity-control input {
    flex-grow: 1;
    min-width: 0;
    border-radius: 4px 0 0 4px;
    border-right: none;
    margin-bottom: 0;
}
.quantity-control button {
    width: 40px;
    flex-shrink: 0;
    border-radius: 0;
    padding: 0.8rem;
}
.quantity-control .add-btn {
    background-color: #2a7d5a;
}
.quantity-control .add-btn:hover {
    background-color: #226448;
}
.quantity-control button:last-child {
    border-radius: 0 4px 4px 0;
}
.delete-btn {
    background-color: #c94c4c;
    width: 100%;
}
.delete-btn:hover {
    background-color: #a03c3c;
}
.edit-btn {
   background-color: #4682B4; /* SteelBlue */
   width: 100%;
}
.edit-btn:hover {
   background-color: #41769F;
}

.empty-catalog-message {
    text-align: center;
    padding: 2rem;
    border: 1px solid #eee;
    background-color: #fafafa;
    border-radius: 8px;
    margin-top: 2rem;
}

.empty-catalog-message p {
    font-size: 1.1rem;
    color: #555;
    margin: 0 0 1.5rem 0;
}
.empty-catalog-message p:last-of-type {
    margin-bottom: 2rem;
}

.empty-catalog-message .button {
    font-size: 1.1rem;
    padding: 0.9rem 2rem;
}

/* =================================================================
   CART & ORDERS
   ================================================================= */
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #eee;
}
.cart-item:last-child {
    border-bottom: none;
}
.cart-item-info {
    display: flex;
    flex-direction: column;
}
.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quantity-selector button {
    width: 35px;
    height: 35px;
    padding: 0;
    font-size: 1.2rem;
    line-height: 35px;
    text-align: center;
}

.cart-item-controls .quantity-input {
    width: 60px;
    text-align: center;
    margin-bottom: 0;
}
.quantity-selector button,
.cart-item-controls .change-qty-btn {
    width: 35px;
    height: 35px;
    padding: 0;
    font-size: 1.2rem;
    line-height: 35px;
    text-align: center;
    flex-shrink: 0;
}

.quantity-selector input {
    width: 50px;
    text-align: center;
    border-left: none;
    border-right: none;
    border-radius: 0;
    margin-bottom: 0;
    padding: 0.5rem;
    height: 35px;
    box-sizing: border-box;
}

.cart-item-controls .remove-from-cart-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    background-color: #c94c4c;
}
.cart-item-controls .remove-from-cart-btn:hover {
    background-color: #a03c3c;
}

.order-item {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}
.order-item ul {
    list-style-type: '– ';
    padding-left: 20px;
}

/* =================================================================
   CUSTOMER
   ================================================================= */

.customer-item {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.customer-item img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    float: left;
    margin-right: 1.5rem;
}
/* =================================================================
   RESPONSIVE & ADAPTIVE STYLES
   ================================================================= */

/* For Tablets */
@media (max-width: 992px) {
    #shop-view, #login-view, #cart-view, #account-view, #admin-main-view {
        margin: 1rem;
        padding: 1.5rem;
    }

    #flower-catalog, #flower-list {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

/* For Mobile Phones */
@media (max-width: 768px) {
    body {
        padding: 0; /* Remove body padding on mobile */
    }

    #shop-view, #login-view, #cart-view, #account-view, #admin-main-view {
        margin: 0;
        padding: 1rem;
        border-radius: 0;
        box-shadow: none;
        min-height: 100vh;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    header nav {
        flex-wrap: wrap;
    }

    #flower-catalog, #flower-list {
        grid-template-columns: 1fr; /* Single column */
    }

    .cart-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* =================================================================
   TOAST / NOTIFICATION STYLES
   ================================================================= */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: #333;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    animation: toast-in 0.5s forwards;
    display: flex;
    align-items: center;
    gap: 15px;
}

.toast.fade-out {
    animation: toast-out 0.5s forwards;
}

.toast-message {
    flex-grow: 1;
}

.toast-link {
    color: #a0c4ff; /* A lighter blue for contrast */
    text-decoration: underline;
    font-weight: bold;
    white-space: nowrap;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* =================================================================
  MODAL STYLES
  ================================================================= */
.modal {
    position: fixed;
    z-index: 1001;
    left: 0;
   top: 0;
   width: 100%; /* Full width */
   height: 100%; /* Full height */
   overflow: auto; /* Enable scroll if needed */
   background-color: rgba(0,0,0,0.5);
   display: flex;
   align-items: center;
   justify-content: center;
   visibility: hidden;
   opacity: 0;
   transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.is-open {
   visibility: visible;
   opacity: 1;
}

.modal-content {
   background-color: #fefefe;
   padding: 2rem;
   border: 1px solid #888;
   width: 80%;
   max-width: 500px;
   border-radius: 8px;
   box-shadow: 0 5px 15px rgba(0,0,0,0.3);
   position: relative;
   animation: modal-in 0.3s ease-out;
}

@keyframes modal-in {
   from {
       transform: scale(0.9);
       opacity: 0;
   }
   to {
       transform: scale(1);
       opacity: 1;
   }
}

.close-button {
   color: #aaa;
   float: right;
   font-size: 28px;
   font-weight: bold;
   position: absolute;
   top: 10px;
   right: 20px;
}

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