
/* ===========================
   PRODUCT MANAGEMENT
=========================== */

*{
    box-sizing:border-box;
}

html,
body{
    width:100%;
    min-height:100%;
    margin:0;
}

body{
    overflow-x:hidden;
    background:#f8f8f8;
    color:#333;
    font-family:Larke, sans-serif;
}

.admin-container{
    width:min(1200px, calc(100% - 48px));
    margin:0 auto;
    padding:48px 0 64px;
}

.admin-header{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:30px;
}

.admin-header h1{
    margin:0;
    font-size:34px;
    font-weight:700;
}

#add-product-btn{
    background:#080402;
    color:#fff;
    border:none;
    padding:14px 24px;
    border-radius:10px;
    font-size:15px;
    font-weight:600;
    cursor:pointer;
    transition:.25s;
}

#add-product-btn:hover{
    opacity:.9;
    transform:translateY(-2px);
}

.products-toolbar{

    margin-bottom:30px;

}
.products-list{
    display:grid;
    grid-template-columns:repeat(auto-fill, minmax(280px, 1fr));
    gap:24px;
    margin-top:30px;
}

#product-search{

    width:100%;

    padding:14px 18px;

    font-size:15px;

    border:1px solid #ddd;

    border-radius:12px;

    outline:none;

    transition:.25s;

    background:#fff;

}

#product-search:focus{

    border-color:#080402;

    box-shadow:0 0 0 3px rgba(8,4,2,.08);

}

.product-card{

    background:#fff;

    border:1px solid #e5e5e5;

    border-radius:16px;

    overflow:hidden;

    transition:.25s;

}

.product-card:hover{

    transform:translateY(-4px);

    box-shadow:0 10px 25px rgba(0,0,0,.08);

}

.product-card img{

    width:100%;

    height:220px;

    object-fit:cover;

    display:block;

}

.product-card-body{

    padding:18px;

}

.product-card-title{

    font-size:18px;

    font-weight:600;

    margin-bottom:8px;

}

.product-card-price{

    font-size:16px;

    font-weight:700;

    color:#080402;

    margin-bottom:16px;

}

.product-card-actions{

    display:flex;

    gap:10px;

}

.product-card-actions button{

    flex:1;

    border:none;

    border-radius:10px;

    padding:10px;

    cursor:pointer;

    font-weight:600;

    transition:.2s;

}

.edit-product{

    background:#080402;

    color:#fff;

}

.delete-product{

    background:#f3f3f3;

    color:#222;

}

.product-card-actions button:hover{

    opacity:.9;

}



.product-modal{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.45);
    display:flex;
    justify-content:center;
    align-items:center;
    z-index:1000;
}

.hidden{
    display:none;
}

.product-modal-content{
    background:#fff;
    width:500px;
    max-width:92%;
    max-height:calc(100dvh - 32px);
    overflow-y:auto;
    border-radius:18px;
    padding:30px;
}

.modal-header{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:25px;
}

.modal-header h2{
    margin:0;
}

.close-modal{
    background:none;
    border:none;
    font-size:30px;
    cursor:pointer;
}

#product-form{
    display:flex;
    flex-direction:column;
    gap:18px;
}

#product-form input,
#product-form textarea{
    padding:14px;
    border:1px solid #ddd;
    border-radius:10px;
    font-size:15px;
}

#product-form button{
    background:#E5A484;
    color:#fff;
    border:none;
    padding:14px;
    border-radius:10px;
    cursor:pointer;
    font-weight:600;
}

.admin-products-toast{
    position:fixed;
    right:24px;
    bottom:24px;
    z-index:1200;
    max-width:calc(100vw - 32px);
    padding:13px 18px;
    border-radius:12px;
    background:#333;
    color:#fff;
    box-shadow:0 10px 28px rgba(0,0,0,.18);
    opacity:0;
    pointer-events:none;
    transform:translateY(12px);
    transition:opacity .2s ease, transform .2s ease;
}

.admin-products-toast.show{
    opacity:1;
    transform:translateY(0);
}

@media (max-width:600px){
    .admin-container{
        width:100%;
        padding:24px 16px 48px;
    }

    .admin-header{
        align-items:flex-start;
        gap:16px;
        margin-bottom:24px;
    }

    .admin-header h1{
        min-width:0;
        font-size:clamp(25px, 8vw, 32px);
        line-height:1.08;
    }

    #add-product-btn{
        flex:0 0 auto;
        padding:11px 14px;
        font-size:13px;
    }

    .products-list{
        grid-template-columns:repeat(2, minmax(0, 1fr));
        gap:12px;
        margin-top:22px;
    }

    .product-card img{
        height:auto;
        aspect-ratio:2 / 3;
    }

    .product-card-body{
        padding:12px;
    }

    .product-card-title{
        overflow:hidden;
        font-size:15px;
        text-overflow:ellipsis;
        white-space:nowrap;
    }

    .product-card-price{
        font-size:13px;
    }

    .product-card-actions{
        flex-direction:column;
    }

    .product-modal{
        padding:16px;
    }

    .product-modal-content{
        width:100%;
        max-width:100%;
        padding:22px 18px;
    }

    .admin-products-toast{
        right:auto;
        bottom:18px;
        left:50%;
        width:max-content;
        transform:translate(-50%, 12px);
    }

    .admin-products-toast.show{
        transform:translate(-50%, 0);
    }
}
